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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kristiankjaergaard at gmail dot com
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Wed Oct 28 18:01:24 2020 UTC