#38066 [Opn->Bgs]: Variables are not passed on to files included by classes
| From: | tony2001@php.net | Date: | Tue, 11 Jul 2006 14:56:56 +0000 |
| Subject: | #38066 [Opn->Bgs]: Variables are not passed on to files included by classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99326@lists.php.net to get a copy of this message | ||
ID: 38066
Updated by: tony2001@php.net
Reported By: kristiankjaergaard at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: *Programming Data Structures
Operating System: Window XP
PHP Version: 5.1.4
New Comment:
Only local function scope is passed to the included file when it's
included from a function.
This is expected.
Previous Comments:
------------------------------------------------------------------------
[2006-07-11 14:52:23] kristiankjaergaard at gmail dot com
Description:
------------
When files are included from within classes, variables are not passed
on to the included files.
Reproduce code:
---------------
a.php:
<?php
class Factory
{
static function doinclude() {
include_once('b.php');
}
}
$var = "I've found a bug";
var_dump($var);
Factory::doinclude();
?>
b.php:
<?php
var_dump($var);
?>
Expected result:
----------------
string(16) "I've found a bug" string(16) "I've found a bug"
Actual result:
--------------
string(16) "I've found a bug" NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38066&edit=1