|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-05-22 12:00 UTC] the_djmaze at hotmail dot com
-Status: Open
+Status: Closed
[2017-05-22 12:00 UTC] the_djmaze at hotmail dot com
[2017-05-22 14:01 UTC] requinix@php.net
-Status: Closed
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
Description: ------------ When an empty element has attributes and you loop through them, the isEmptyElement changes from false to true. Test script: --------------- <?php $reader = new XMLReader(); $reader->xml('<?xml version="1.0"?><tr xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <td xsi:nil="true"/><td/> </tr>', null, LIBXML_COMPACT); while ($reader->read()) { switch ($reader->nodeType) { case XMLReader::ELEMENT: echo "{$reader->name}: " . ($reader->isEmptyElement ? 'empty element' : 'has data'); $attributes = array(); if ($reader->hasAttributes) { while ($reader->moveToNextAttribute()) { $attributes[$reader->localName] = $reader->value; } } echo ($reader->isEmptyElement ? ' = empty element' : ' = has data') . "\n"; break; case XMLReader::END_ELEMENT: echo "/{$reader->name}\n"; } } Expected result: ---------------- isEmptyElement = true Actual result: -------------- isEmptyElement = false