Bug #53388 [NEW]: problems extending DOMAttr (cannot overload DOMAttr value)
| From: | luka8088 at owave dot net | Date: | Tue, 23 Nov 2010 14:46:11 +0000 |
| Subject: | Bug #53388 [NEW]: problems extending DOMAttr (cannot overload DOMAttr value) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-156320@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: 5.3.3
Package: DOM XML related
Bug Type: Bug
Bug description:problems extending DOMAttr (cannot overload DOMAttr value)
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 bug report at http://bugs.php.net/bug.php?id=53388&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53388&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53388&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53388&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53388&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53388&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53388&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53388&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53388&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53388&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53388&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53388&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53388&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53388&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53388&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53388&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53388&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53388&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53388&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53388&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53388&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53388&r=mysqlcfg