From:             eingmarra at hotmail dot com
Operating system: windowsxp sp2
PHP version:      5.2.0
PHP Bug Type:     Class/Object related
Bug description:  static variable shows abnormal performence

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

-- 
Edit bug report at http://bugs.php.net/?id=39852&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39852&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39852&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39852&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39852&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39852&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39852&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39852&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39852&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39852&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39852&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39852&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39852&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39852&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39852&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39852&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39852&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39852&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39852&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39852&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39852&r=mysqlcfg

Reply via email to