title: PHP: is there any case in which "include_once" resets the stack?
body: <p>Say I have this code:</p>
  
  <pre><code>class control {
    function public_home()
      {
          $pagina=$this-&gt;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;
              }
  ...
  }
  </code></pre>
  
  <p>And then, in <code>page.php</code>:</p>
  
  <pre><code>&lt;?php
  echo "LANG " . $langlink;
  echo "NODE " . $localnode;
  ?&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
  ...
  </code></pre>
  
  <p><code>page.php</code> should be able to access both <code>$langlink</code> and <code>$localnode</code> variables without problems, right? (I have tried with a simplified example and it does work). Well, in my case it doesn't; no matter how I try, the code in page.php says that <code>$langlink</code> and <code>$localnode</code> are undefined.</p>
  
  <p>Not only that: if I add a <code>var_dump(debug_backtrace())</code> to <code>page.php</code>, it will show me only:</p>
  
  <pre><code>array(1) {
    [0]=&gt;
    array(3) {
      ["file"]=&gt;
      string(53) "index.php"
      ["line"]=&gt;
      int(55)
      ["function"]=&gt;
      string(12) "include_once"
    }
  }
  </code></pre>
  
  <p>In other words, it doesn't pick up neither the <code>load_public_page</code> function, not its containing class... No wonder it can't find those variables.</p>
  
  <p>It's extremely odd, because look at the simplified example I mentioned above:</p>
  
  <pre><code>class Ble {
      function bla() {
          $a=127;
  
          $pagina=$this-&gt;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-&gt;bla();
  </code></pre>
  
  <p>Where <code>b.php</code> is:</p>
  
  <pre><code>&lt;p&gt;BBB is: &lt;?php echo $bbb; ?&gt;&lt;/p&gt;
  
  &lt;p&gt;What is A? &lt;?php echo $a; ?&gt;
  </code></pre>
  
  <p>It does print <code>$a</code> as <code>666</code>, as it should, and of course, if I add a <code>debug_backtrace</code> in <code>b.php</code>, it shows me the full stack trace: <code>object Ble, function bla, function otrosi</code>....</p>
  
  <p>As the title says: does anyone know of any circunstances in which an <code>include_once</code> or output buffering might reset the stack in PHP? I'm a bit desperate, because this is one of those things where, according to docs and simple examples, it SHOULD work... and yet it doesn't.</p>