note 114395 added to function.property-exists

From: Date: Sat, 15 Feb 2014 04:37:45 +0000
Subject: note 114395 added to function.property-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-198519@lists.php.net to get a copy of this message
As of PHP 5.3.0, calling property_exists from a parent class sees private properties in sub-classes. <?php class P { public function test_prop($prop) { return property_exists($this, $prop); } } class Child extends P { private $prop1; } $child = new Child(); var_dump($child->test_prop('prop1')); //true, as of PHP 5.3.0 ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.property-exists.php Edit -- https://master.php.net/note/edit/114395 Del: integrated -- https://master.php.net/note/delete/114395/integrated Del: useless -- https://master.php.net/note/delete/114395/useless Del: bad code -- https://master.php.net/note/delete/114395/bad+code Del: spam -- https://master.php.net/note/delete/114395/spam Del: non-english -- https://master.php.net/note/delete/114395/non-english Del: in docs -- https://master.php.net/note/delete/114395/in+docs Del: other reasons-- https://master.php.net/note/delete/114395 Reject -- https://master.php.net/note/reject/114395 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198519) next »