Edit report at https://bugs.php.net/bug.php?id=70029&edit=1
ID: 70029
Updated by: cmb@php.net
Reported by: Laurent dot Lyaudet at gmail dot com
Summary: nodeValue of DOMElement list content of children
nodes
Status: Re-Opened
Type: Bug
Package: DOM XML related
Operating System: Debian Linux
PHP Version: 5.4.42
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
After some further discussion on the internals mailing list[1], it
seems to be best to postpone the "fix" until PHP 7.1.
[1] <http://markmail.org/message/d7bwuawbccnjklvm>
Previous Comments:
------------------------------------------------------------------------
[2015-09-08 22:03:08] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=337788
Log: DOMElement::nodeValue does not conform to W3C specs (related to bug #70029)
------------------------------------------------------------------------
[2015-09-08 21:28:53] me at kelunik dot com
textContent seems like a good alternative, missed that, it's probably fine with a small
explanation in UPGRADE then.
------------------------------------------------------------------------
[2015-09-08 19:05:30] Laurent dot Lyaudet at gmail dot com
Hi,
Please correct it again.
It's way better to have standard compliance than having code relying on non documented,
unwanted behavior. Code relying on non standard is not portable and reference implementation of DOM
API in PHP should be standard compliant.
Moreover the feature is not removed since it already exists with textContent as you pointed out.
The only negative point is BC break but it is only a minor point since it's so easy to change
nodeValue for textContent in that case.
It's sufficient to explain this possible fix in the release note.
If, for a reason I don't see, it's more clever to have textContent than having null in
nodeValue of DOMElements, then it should be first explained why. And it should be explained not only
here but also at the W3C where the debate should be.
Best regards,
Laurent Lyaudet
------------------------------------------------------------------------
[2015-09-06 13:39:14] cmb@php.net
I have reverted the fix and the respective UPGRADING and NEWS
entries.
> Fixing it has exactly zero benefits (except spec compliance)> while it introduces a BC break and removes a useful features.
IMHO, standard compliance is a benefit, especially as the manual
states[1]:
| The DOM extension allows you to operate on XML documents through
| the DOM API with PHP 5.
Furthermore I don't see a good reason to use DOMNode::nodeValue
instead of DOMNode::textContent to get the text content of a node.
[1] <http://www.php.net/manual/en/intro.dom.php>
------------------------------------------------------------------------
[2015-09-06 13:38:04] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1b344f55f4dc033cba41a94cbe0d2fdc2ad606a6
Log: Revert "Fix #70029: nodeValue of DOMElement list content of children nodes"
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=70029
--
Edit this bug report at https://bugs.php.net/bug.php?id=70029&edit=1