php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11572 global variables cannot be accessed from an objects function?
Submitted: 2001-06-20 01:44 UTC Modified: 2001-06-20 17:34 UTC
From: vincev at gmx dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: debian linux
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: vincev at gmx dot de
New email:
PHP Version: OS:

 

 [2001-06-20 01:44 UTC] vincev at gmx dot de
class a {
	function a() {
		if(!isset($GLOBALS["b"])) {
			echo "loading b";
			$GLOBALS["b"] = new b();
		}
	}
}
class b {
	function b() {
		if(!isset($GLOBALS["a"])) {
			echo "loading a";
			$GLOBALS["a"] = new a();
		}
	}
}
# creates an infinite loop
new a();

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-20 17:34 UTC] hholzgra@php.net
the constructors are called *before* assigning
the results so what do you expect to happen?


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC