Professional Web Applications Themes

#40737 [NEW]: Variable passing by reference instead of copying. - PHP Bugs

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 ...

  1. #1

    Default #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

  2. #2

    Default #40737 [Opn->Fbk]: Variable passing by reference instead of copying.

    ID: 40737
    Updated by: [email]tony2001php.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

  3. #3

    Default #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]tony2001php.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

Similar Threads

  1. Copying A Control Not As A Reference
    By Nathan Sokalski in forum ASP.NET Building Controls
    Replies: 4
    Last Post: June 12th, 09:30 AM
  2. Passing Variables by Reference
    By babo_ya in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: February 22nd, 10:29 PM
  3. passing global variable by reference?
    By Don S in forum PERL Modules
    Replies: 2
    Last Post: February 22nd, 02:56 PM
  4. passing row types by reference
    By Pablo in forum Informix
    Replies: 1
    Last Post: August 7th, 10:28 PM
  5. Replies: 7
    Last Post: July 17th, 04:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139