Bug #53388 [Opn->Nab]: problems extending DOMAttr (cannot overload DOMAttr value)
| From: | mike@php.net | Date: | Tue, 03 Dec 2013 07:51:48 +0000 |
| Subject: | Bug #53388 [Opn->Nab]: problems extending DOMAttr (cannot overload DOMAttr value) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183084@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53388&edit=1
ID: 53388
Updated by: mike@php.net
Reported by: luka8088 at owave dot net
Summary: problems extending DOMAttr (cannot overload DOMAttr
value)
-Status: Open
+Status: Not a bug
Type: Bug
Package: DOM XML related
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
Unfortunately, this is not supported. DOM classes' properties are usually stored deep inside
some C struct.
Previous Comments:
------------------------------------------------------------------------
[2010-11-24 09:11:00] luka8088 at owave dot net
sorry, my mistake... it should be:
Expected result:
----------------
object(Custom_DOMAttr)#1 (1) {
["value"]=>
string(8) "other_value"
}
string(11) "other_value"
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=53388&edit=1