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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 15:01:31 2025 UTC