|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-23 15:46 UTC] 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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 06:00:01 2025 UTC |
sorry, my mistake... it should be: Expected result: ---------------- object(Custom_DOMAttr)#1 (1) { ["value"]=> string(8) "other_value" } string(11) "other_value"