php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73907 nextSibling property not included in var_dump of DOMNode
Submitted: 2017-01-10 14:32 UTC Modified: 2017-01-10 17:37 UTC
From: arnout dot boks at moxio dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 7.0.14 OS: Debian 8
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: arnout dot boks at moxio dot com
New email:
PHP Version: OS:

 

 [2017-01-10 14:32 UTC] arnout dot boks at moxio dot com
Description:
------------
When doing a var_dump of a DOMNode (or one of its subclasses), the nextSibling-property does not show up. Other properties (like previousSibling) are shown as expected.

Test script:
---------------
<?php
$xmlString = '<?xml version="1.0" encoding="utf-8" ?>
<root>
</root>';

$doc = new DOMDocument();
$doc->loadXML($xmlString);
$attr = $doc->documentElement;

var_dump($attr);

Expected result:
----------------
// ... <snip> ...
  ["nextSibling"]=>
  NULL
// ... <snip> ...

Actual result:
--------------
// ... <snip> ...
// (no nextSibling)
// ... <snip> ...

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-10 17:37 UTC] cmb@php.net
-Status: Open +Status: Analyzed
 [2017-01-10 17:37 UTC] cmb@php.net
I can confirm the issue: <https://3v4l.org/IrP6M>.

The problem appears to be in dom_node_next_sibling_read() which
returns FAILURE if there is no next sibling[1]. Compare that with
dom_node_previous_sibling_read() which sets the retval to NULL and
returns SUCCESS[2].

Several related cases had been fixed with commit 63ccee5b[3], but
dom_node_next_sibling_read() had apparently overlooked.

[1] <https://github.com/php/php-src/blob/PHP-7.0.14/ext/dom/node.c#L551-L553>
[2] <https://github.com/php/php-src/blob/PHP-7.0.14/ext/dom/node.c#L523-L526>
[3] <http://git.php.net/?p=php-src.git;a=commit;h=63ccee5b>
 [2017-01-10 22:30 UTC] nikic@php.net
Automatic comment on behalf of arnoutboks@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=13edec75a32f8de674a9e0d5b295f9b872212343
Log: Fixed #73907 (nextSibling property not included in var_dump of DOMNode)
 [2017-01-10 22:30 UTC] nikic@php.net
-Status: Analyzed +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 04:01:29 2025 UTC