php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22872 returning reference to passed by reference varibale of class corrupts it.
Submitted: 2003-03-25 07:28 UTC Modified: 2003-03-25 07:31 UTC
From: voland at cms dot ru Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.1 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: voland at cms dot ru
New email:
PHP Version: OS:

 

 [2003-03-25 07:28 UTC] 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;

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-25 07:31 UTC] moriyoshi@php.net
Almost same as bug #21600

The fix will be in php5

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 17 19:00:03 2025 UTC