php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53388 problems extending DOMAttr (cannot overload DOMAttr value)
Submitted: 2010-11-23 15:46 UTC Modified: 2013-12-03 08:11 UTC
From: luka8088 at owave dot net Assigned:
Status: Wont fix Package: DOM XML related
PHP Version: 5.3.3 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: luka8088 at owave dot net
New email:
PHP Version: OS:

 

 [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"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 09:11 UTC] 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"
 [2013-12-03 07:51 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-12-03 07:51 UTC] mike@php.net
Unfortunately, this is not supported. DOM classes' properties are usually stored deep inside some C struct.
 [2013-12-03 08:08 UTC] luka8088 at owave dot net
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"?
 [2013-12-03 08:11 UTC] mike@php.net
-Status: Not a bug +Status: Wont fix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC