Ask a Question related to PHP Bugs, Design and Development.
-
anter at voliacable dot com #1
#40737 [NEW]: Variable passing by reference instead of copying.
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 [url]http://bugs.php.net/?id=40737&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40737&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40737&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40737&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40737&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=40737&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=40737&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40737&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=40737&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=40737&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=40737&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=40737&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=40737&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=40737&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40737&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=40737&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=40737&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40737&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=40737&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40737&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40737&r=mysqlcfg[/url]
anter at voliacable dot com Guest
-
Copying A Control Not As A Reference
I have a Control that I want to copy as a copy of the Control, not a copy of the reference to the original. My reason for doing this is because some... -
Passing Variables by Reference
I have a webservice that accepts some variables by reference and after the service is called, all the passed variables are 'undefined' Thanks for... -
passing global variable by reference?
I'm trying to stick my frequently used subroutines into a Sysadmin.pm module. Of course the first one I tried uses global variables and I wondering... -
passing row types by reference
Hallo, I´m working with the new informix funcionality that allow use structure data like rows an list rows. I would like to know how I can... -
passing javascript variable into asp variable using vbscript
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script... -
tony2001@php.net #2
#40737 [Opn->Fbk]: Variable passing by reference instead of copying.
ID: 40737
Updated by: [email]tony2001@php.net[/email]
Reported By: anter at voliacable dot com
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: XP Prof SP2
PHP Version: 5.2.1
New Comment:
Cannot reproduce.
Please make sure you've disabled all zend extensions like Zend
Optimizer, eAccelerator, APC, IonCube etc.
Previous Comments:
------------------------------------------------------------------------
[2007-03-06 06:45:47] anter at voliacable dot com
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 this bug report at [url]http://bugs.php.net/?id=40737&edit=1[/url]
tony2001@php.net Guest
-
anter at voliacable dot com #3
#40737 [Fbk->Csd]: Variable passing by reference instead of copying.
ID: 40737
User updated by: anter at voliacable dot com
Reported By: anter at voliacable dot com
-Status: Feedback
+Status: Closed
Bug Type: Class/Object related
Operating System: XP Prof SP2
-PHP Version: 5.2.1
+PHP Version: 5.2.0
New Comment:
I am sorry, I had version 5.2.0. In version 5.2.1 all works normally.
Previous Comments:
------------------------------------------------------------------------
[2007-03-06 10:49:29] [email]tony2001@php.net[/email]
Cannot reproduce.
Please make sure you've disabled all zend extensions like Zend
Optimizer, eAccelerator, APC, IonCube etc.
------------------------------------------------------------------------
[2007-03-06 06:45:47] anter at voliacable dot com
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 this bug report at [url]http://bugs.php.net/?id=40737&edit=1[/url]
anter at voliacable dot com Guest



Reply With Quote

