|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-05-25 09:08 UTC] mike@php.net
-Status: Open
+Status: Bogus
[2010-05-25 09:08 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 14 05:00:01 2025 UTC |
Description: ------------ If you overwrite __set in a child class, the parent implementation is called first and than triggers the child version. I found another bug, which says that you should implement the __set method in the parent class, but it in this case both methods are called. A similar bug is reported in #44807, but it's only about the recursion prevention. Test script: --------------- <?php class Foo { function __set($key, $value) { $this->{$key} = $value . ' (Foo)'; } } class Bar extends Foo { function __set($key, $value) { $this->{$key} = $value . ' (Bar)'; } function set() { parent::__set('foobar', 'Test'); } } $bar = new Bar(); $bar->set(); echo $bar->foobar; ?> Expected result: ---------------- Test (Foo) Actual result: -------------- Test (Foo) (Bar)