#22872 [Opn->Csd]: returning reference to passed by reference varibale of class corrupts it.

From: Date: Tue, 25 Mar 2003 13:31:57 +0000
Subject: #22872 [Opn->Csd]: returning reference to passed by reference varibale of class corrupts it.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-36387@lists.php.net to get a copy of this message
 ID:               22872
 Updated by:       moriyoshi@php.net
 Reported By:      voland at cms dot ru
-Status:           Open
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Windows
 PHP Version:      4.3.1
 New Comment:

Almost same as bug #21600

The fix will be in php5



Previous Comments:
------------------------------------------------------------------------

[2003-03-25 07:28:12] voland at cms dot ru

ex:

<?php 
  function &foo(&$v) 
  { return $v;
  }
  class Cl 
  { var $a=5; 
  } 
  $x=&new Cl(); 
  print_r($x);
  $x=&foo($x); 
  print_r($x); 
?>
outputs:
cl Object
(
    [a] => 5
)
cl Object
(
)
but if we change 
  $x=&foo($x); 
  print_r($x); 
to
  $y=&foo($x); 
  print_r($y); 

everything works fine;


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22872&edit=1



Thread (2 messages)

« previous php.bugs (#36387) next »