php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2136 require/include parsing error
Submitted: 1999-08-23 18:59 UTC Modified: 2001-02-10 15:51 UTC
From: kamee at methadonia dot net Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: openbsd
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kamee at methadonia dot net
New email:
PHP Version: OS:

 

 [1999-08-23 18:59 UTC] kamee at methadonia dot net
i have noticed a problem with the following php code is ran...

<?
class foo {
        function foo {
                require 'settings.php';
        }
}
?>

settings.php
------------
<?
var $foo_variable = 100;
?>

the problem seems that when you include/require a file within a class constructor any variables that are initialized within the included file are not accessible o
utside of the included php file (ie. i cannot use foo_variable later within the class foo.) I think this is caused because when the file settings.php is parsed it doesnt consider the variable eligible for the 'var' addition because of its lack of being within the function declaration (even though it really is.)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-10 15:51 UTC] jimw@php.net
putting "var $name" inside a function doesn't define it inside the class.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC