php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38066 Variables are not passed on to files included by classes
Submitted: 2006-07-11 14:52 UTC Modified: 2006-07-14 13:37 UTC
From: kristiankjaergaard at gmail dot com Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 5.1.4 OS: Window XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
26 - 21 = ?
Subscribe to this entry?

 
 [2006-07-11 14:52 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-11 14:56 UTC] tony2001@php.net
Only local function scope is passed to the included file when it's included from a function.
This is expected.
 [2006-07-14 13:37 UTC] kristiankjaergaard at gmail dot com
I'm sorry to waste your time then.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC