From:             [EMAIL PROTECTED]
Operating system: Windows 2000, Windows XP
PHP version:      4.1.2
PHP Bug Type:     Class/Object related
Bug description:  Function called from class treats GLOBAL vars in different way...

There is the line marked with '//*' in the following script. One line up
you will find other line that should make the exactly same action (I
think). Try to comment this line and uncomment line with '//*'. The output
will differ. Why?

--- SCRIPT: START ---
<PRE>
<?php

class test {
        function test() {
                extfunc($this);
        }
}
#___________________________________________________________
function extfunc(&$ref) {
global $obj;
        if (is_object($ref)) {
                $GLOBALS["obj"]=&$ref; # This is the same as '$obj=&$ref;'. Isn't it?
                #* $obj=&$ref;
        }
}

#===========================================================
$test=new test();
var_dump($obj);

?>
</PRE>
--- SCRIPT: END ---
-- 
Edit bug report at http://bugs.php.net/?id=16610&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16610&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16610&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16610&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16610&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16610&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16610&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16610&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16610&r=submittedtwice

Reply via email to