php include - PHP: is there any case in which "include_once" resets the stack? -


say have code:

class control {   function public_home()     {         $pagina=$this->load_public_page();         ...         echo $pagina;     }  ...         function load_public_page($localnode="") {              global $language;              if ($localnode != "") { $localnode="_" . $localnode; }              $langlink = "http://" . page_index;             if ($language != "es") { $langlink = $langlink . "/" . $language . "/"; }              ob_start();             include_once 'page.php';             include_once 'header.php';             $pagina=ob_get_contents();             ob_end_clean();             return $pagina;             } ... } 

and then, in page.php:

<?php echo "lang " . $langlink; echo "node " . $localnode; ?> <html>     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8"> ... 

page.php should able access both $langlink , $localnode variables without problems, right? (i have tried simplified example , work). well, in case doesn't; no matter how try, code in page.php says $langlink , $localnode undefined.

not that: if add var_dump(debug_backtrace()) page.php, show me only:

array(1) {   [0]=>   array(3) {     ["file"]=>     string(53) "index.php"     ["line"]=>     int(55)     ["function"]=>     string(12) "include_once"   } } 

in other words, doesn't pick neither load_public_page function, not containing class... no wonder can't find variables.

it's extremely odd, because @ simplified example mentioned above:

class ble {     function bla() {         $a=127;          $pagina=$this->otrosi();         echo $pagina;         }      function otrosi($bbb="") {          $a=666;          ob_start();         include_once('b.php');         $pagina=ob_get_contents();         ob_end_clean();          return $pagina;         }     }  $g=new ble();    $g->bla(); 

where b.php is:

<p>bbb is: <?php echo $bbb; ?></p>  <p>what a? <?php echo $a; ?> 

it print $a 666, should, , of course, if add debug_backtrace in b.php, shows me full stack trace: object ble, function bla, function otrosi....

as title says: know of circunstances in include_once or output buffering might reset stack in php? i'm bit desperate, because 1 of things where, according docs , simple examples, should work... , yet doesn't.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -