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
 [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 11:01:30 2024 UTC