Bug #53388 [Nab]: problems extending DOMAttr (cannot overload DOMAttr value)
| From: | luka8088 at owave dot net | Date: | Tue, 03 Dec 2013 08:08:19 +0000 |
| Subject: | Bug #53388 [Nab]: problems extending DOMAttr (cannot overload DOMAttr value) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183085@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
User updated by: luka8088 at owave dot net
Reported by: luka8088 at owave dot net
Summary: problems extending DOMAttr (cannot overload DOMAttr
value)
Status: Not a bug
Type: Bug
Package: DOM XML related
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
On [2013-12-03 07:51 UTC] mike@php.net wrote:
>Unfortunately, this is not supported. DOM classes' properties are usually stored deep
>inside some C struct.
I know that this is not supported and that they are stored in C struct and that is why I filled a
bug report. Just because some implementation is not behaving according to php rules does not mean
that it is not a bug.
If it is not a bug, then can you please confirm that current behavior is correct and that it should
never change?
Or by marking it as "not a bug" you actually mean "we don't want to fix
this" or "it is too complicated to fix at the moment"?
Previous Comments:
------------------------------------------------------------------------
[2013-12-03 07:51:47] mike@php.net
Unfortunately, this is not supported. DOM classes' properties are usually stored deep inside
some C struct.
------------------------------------------------------------------------
[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