From: anter at voliacable dot com
Operating system: XP Prof SP2
PHP version: 5.2.1
PHP Bug Type: Class/Object related
Bug description: Variable passing by reference instead of copying.
Description:
------------
In the Simple::$var property the reference to a variable instead of a copy
is located, depending on many conditions.
If lines 6 and 8 of bug.php to change places the expected result is
received.
If to remove a line 7 of bug.php the expected result is received.
If remove a line 1 of bug.php and to place contents of a Simple.php in a
bug.php the expected result is received.
Reproduce code:
---------------
<file Simple.php>
1 class Simple
2 {
3 protected static $var;
4
5 public static function setVar($value)
6 {
7 self::$var = $value;
8 }
9 }
<file bug.php>
1 require_once('Simple.php');
2
3 $var1 = 'value1';
4 $var2 = 'value2';
5
6 Simple::setVar($var1);
7
8 class VerySimple extends Simple {}
9
10 Simple::setVar($var2);
11
12 print $var1;
Expected result:
----------------
value1
Actual result:
--------------
value2
--
Edit bug report at http://bugs.php.net/?id=40737&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40737&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40737&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40737&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40737&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40737&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40737&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40737&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40737&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40737&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40737&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40737&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40737&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40737&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40737&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40737&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40737&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40737&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40737&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40737&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40737&r=mysqlcfg