Bug #53388 [Opn]: problems extending DOMAttr (cannot overload DOMAttr value)

From: Date: Wed, 24 Nov 2010 08:11:00 +0000
Subject: Bug #53388 [Opn]: problems extending DOMAttr (cannot overload DOMAttr value)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-156347@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53388&edit=1 ID: 53388 User updated by: luka8088 at owave dot net Reported by: luka8088 at owave dot net Summary: problems extending DOMAttr (cannot overload DOMAttr value) Status: Open Type: Bug Package: DOM XML related PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: sorry, my mistake... it should be: Expected result: ---------------- object(Custom_DOMAttr)#1 (1) { ["value"]=> string(8) "other_value" } string(11) "other_value" Previous Comments: ------------------------------------------------------------------------ [2010-11-23 15:46:11] luka8088 at owave dot net Description: ------------ It seems there is some problem in DOMAttr (and possibly other DOM classes) implementation... DOMAttr completely ignores $value in custom class, setting it to private and using magic methods also does not work as expected <?php class Custom_DOMAttr extends DOMAttr { public $value = 'my_value'; } $attr = new Custom_DOMAttr("name"); $attr->value = "other_value"; var_dump($attr); // object(Custom_DOMAttr)#1 (1) { ["value"]=> string(8) "my_value" } var_dump($attr->value); // string(11) "other_value" ?> Test script: --------------- <?php class Custom_DOMAttr extends DOMAttr { public $value = 'my_value'; } $attr = new Custom_DOMAttr("name"); $attr->value = "other_value"; var_dump($attr); var_dump($attr->value); ?> Expected result: ---------------- object(Custom_DOMAttr)#1 (1) { ["value"]=> string(8) "my_value" } string(11) "my_value" Actual result: -------------- object(Custom_DOMAttr)#1 (1) { ["value"]=> string(8) "my_value" } string(11) "other_value" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53388&edit=1

« previous php.bugs (#156347) next »