php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39852 static variable shows abnormal performence
Submitted: 2006-12-16 12:29 UTC Modified: 2006-12-18 08:36 UTC
From: eingmarra at hotmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.0 OS: windowsxp sp2
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: eingmarra at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-12-16 12:29 UTC] eingmarra at hotmail dot com
Description:
------------
Hi Master!
I used php5.2 to write a class for some needs, I was surperised to find the static variable worked in an abnormal way, so I need you help to test it!

--- test.php
<?php
class JavaBridgeLoader {
	private static $configedFlag = false;
	const jar_path = "jar/";
		
    public static function preConfig(){
    	var_dump(self::$configedFlag);
    	if(self::$configedFlag == false){
    		//exec('java -jar '. self::jar_path. '"JavaBridge.jar" SERVLET:8080');
    		
    		self::$configedFlag = true;
    	}
    	var_dump(self::$configedFlag);
    } 	
}
JavaBridgeLoader::preconfig();
?>


I expect for the result is "bool(false) bool(true) at the first time, And then: bool(true) bool(true) at the second time"

I am not a phper, I am a java liker and want to learn the php lanugage, I dont know why it can not performence like java performence, So I report this bug!

Thank you and hoping for you responsing...
And best Regards to you all!



Reproduce code:
---------------
<?php
class JavaBridgeLoader {
	private static $configedFlag = false;
	const jar_path = "jar/";
		
    public static function preConfig(){
    	var_dump(self::$configedFlag);
    	if(self::$configedFlag == false){
    		//exec('java -jar '. self::jar_path. '"JavaBridge.jar" SERVLET:8080');
    		
    		self::$configedFlag = true;
    	}
    	var_dump(self::$configedFlag);
    } 	
}
JavaBridgeLoader::preconfig();
?>

Expected result:
----------------
bool(false) bool(true) ---- the first time 

bool(true) bool(true)  ---- the second time

Actual result:
--------------
bool(false) bool(true) ---- the first time 

bool(false) bool(true)  ---- the second time

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-18 08:36 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC