php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2015 static php3 incompatibility
Submitted: 1999-08-09 19:21 UTC Modified: 1999-11-22 23:09 UTC
From: sander at pilon dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 2 OS: Linux 2.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 + 7 = ?
Subscribe to this entry?

 
 [1999-08-09 19:21 UTC] sander at pilon dot com
	function 	test()
	{
		static $test1;
		echo "BEFORE: $test1 <BR>";
		
		unset($test1);
		
		$test1 = "Hello";		
		echo "AFTER: $test1 <BR>";
	}		

        test(); test();

Output:

BEFORE: 
AFTER: Hello 
-- 
BEFORE: 
AFTER: Hello 

Should be: 
BEFORE: 
AFTER: Hello 
-- 
BEFORE: Hello
AFTER: Hello 

Works fine if you remove the unset();
Works fine in PHP3.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-22 23:09 UTC] zeev at cvs dot php dot net
known incompatibility - unset() in PHP 4.0 unsets the reference
to the static variable, rather than the static variable itself.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 17:01:30 2024 UTC