ID: 37212 Updated by: [EMAIL PROTECTED] Reported By: andreasblixt at msn dot com -Status: Assigned +Status: Closed Bug Type: Class/Object related Operating System: * -PHP Version: 5.1.*, 5.2.0-dev +PHP Version: 5.1.* Assigned To: helly New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed in 5.2, cannot fix in 5.0/5.1 Previous Comments: ------------------------------------------------------------------------ [2006-05-27 02:14:58] [EMAIL PROTECTED] Fixed in HEAD so far. ------------------------------------------------------------------------ [2006-05-27 02:05:19] [EMAIL PROTECTED] Fix requies API change so it is not doable in 5.1. ------------------------------------------------------------------------ [2006-05-27 01:40:49] [EMAIL PROTECTED] The problem is that right now struct property_info does not know where the property was declared. Thus what the engine sees is B accessing some protected property in C. The fix seems however quite easy. I'll give it a try. ------------------------------------------------------------------------ [2006-05-05 19:03:33] [EMAIL PROTECTED] Probably a missing check if the property was declared in a common parent class? ------------------------------------------------------------------------ [2006-04-27 19:39:38] crescentfreshpot at yahoo dot com Odd. Here is a complete example. <?php class A { protected $value; public function __construct($val) { $this->value = $val; } public function copyValue($obj) { $this->value = $obj->value; } protected function getValue() { return $this->value; } } class B extends A { public function copyValue($obj) { $this->value = $obj->getValue(); // this works $this->value = $obj->value; // this is fatal } } class C extends A {} $B = new B("Value from B"); $C = new C("Value from C"); $B->copyValue($C); ?> Strange that the method call works but the property access doesn't. Both are protected. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37212 -- Edit this bug report at http://bugs.php.net/?id=37212&edit=1