| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2014-07-06 01:50 UTC] yohgaki@php.net
 
-Status: Open
+Status: Verified
  [2014-07-06 01:50 UTC] yohgaki@php.net
  [2017-10-29 08:51 UTC] jhdxr@php.net
 
-Status: Verified
+Status: Not a bug
  [2017-10-29 08:51 UTC] jhdxr@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 15:00:01 2025 UTC | 
Description: ------------ get_object_vars() returns an array which can be manipulated as you would using a normal object. Manipulating the resulting array should not manipulate the object itself, but it does in this case. Test script: --------------- class Foo { public $bar = null; public function __construct() { $this->bar = new DateTime(); // Now $this->far = &$this->bar; } } $foo= new Foo(); var_dump($foo); $vars = get_object_vars($foo); $vars['bar'] = new DateTime('2014-03-25'); var_dump($foo); Expected result: ---------------- $foo->bar should not be altered, as we are only changing the get_object_vars() array, but it is. Actual result: -------------- $foo->bar (and $foo->far) gets a new value.