note 79088 added to migration52.incompatible

From: Date: Sat, 10 Nov 2007 12:17:46 +0000
Subject: note 79088 added to migration52.incompatible
Groups: php.notes 
Request: Send a blank email to php-notes+get-132161@lists.php.net to get a copy of this message
Between PHP 5.2.3 and 5.2.4 another backward incompatible change was introduced: parent classes now can not access private properties of child classes with get_object_vars(). See the following example: class Bar { public function dumpBar() { var_dump(get_object_vars($this)); } } class Foo extends Bar { public $public = 'public'; protected $protected = 'protected'; private $private = 'private'; public function dump() { var_dump(get_object_vars($this)); } } $foo = new Foo(); $foo->dump(); $foo->dumpBar(); The result with PHP < 5.2.4: E:\php\tests>php get_object_vars.php array(3) { ["public"] => string(6) "public" ["protected"] => string(9) "protected" ["private"] => string(7) "private" } array(3) { ["public"] => string(6) "public" ["protected"] => string(9) "protected" ["private"] => string(7) "private" } And the result with PHP >= 5.2.4: E:\php-5.2.4-Win32>php ../php/tests/get_object_vars.php array(3) { ["public"] => string(6) "public" ["protected"] => string(9) "protected" ["private"] => string(7) "private" } array(2) { ["public"] => string(6) "public" ["protected"] => string(9) "protected" } As you can see the private property is missing now when dumped from the parent class Bar. ---- Server IP: 69.147.83.197 Probable Submitter: 84.163.13.89 ---- Manual Page -- http://www.php.net/manual/en/migration52.incompatible.php Edit -- https://master.php.net/note/edit/79088 Del: integrated -- https://master.php.net/note/delete/79088/integrated Del: useless -- https://master.php.net/note/delete/79088/useless Del: bad code -- https://master.php.net/note/delete/79088/bad+code Del: spam -- https://master.php.net/note/delete/79088/spam Del: non-english -- https://master.php.net/note/delete/79088/non-english Del: in docs -- https://master.php.net/note/delete/79088/in+docs Del: other reasons-- https://master.php.net/note/delete/79088 Reject -- https://master.php.net/note/reject/79088 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132161) next »