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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 01:01:30 2024 UTC