Bug #74629 [NEW]: isEmptyElement returns false instead of true

From: Date: Mon, 22 May 2017 11:46:34 +0000
Subject: Bug #74629 [NEW]: isEmptyElement returns false instead of true
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209219@lists.php.net to get a copy of this message
From: the_djmaze at hotmail dot com Operating system: GNU/Linux PHP version: 7.1.5 Package: XML Reader Bug Type: Bug Bug description:isEmptyElement returns false instead of true 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 -- Edit bug report at https://bugs.php.net/bug.php?id=74629&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74629&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74629&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74629&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74629&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74629&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74629&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74629&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74629&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74629&r=support Expected behavior: https://bugs.php.net/fix.php?id=74629&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74629&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74629&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74629&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74629&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74629&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74629&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74629&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74629&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74629&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74629&r=mysqlcfg

« previous php.bugs (#209219) next »