Bug #80755 [Opn->Nab]: next function does not go strict to next sibling node
| From: | cmb@php.net | Date: | Tue, 16 Feb 2021 11:24:42 +0000 |
| Subject: | Bug #80755 [Opn->Nab]: next function does not go strict to next sibling node | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232184@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80755&edit=1
ID: 80755
Updated by: cmb@php.net
Reported by: joaomfrebelo at gmail dot com
Summary: next function does not go strict to next sibling
node
-Status: Open
+Status: Not a bug
Type: Bug
Package: XML Reader
Operating System: Windows 10
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The next siblings of all the Customer elements are text nodes
(namely the whitespace between the Customer elements).
Previous Comments:
------------------------------------------------------------------------
[2021-02-16 11:18:48] joaomfrebelo at gmail dot com
Description:
------------
When we advance the cursor with next function the cursor position should be the next sibling node,
how ever wrongly the cursor goes always first to the â#textâ node:
Output of the bellow test:
PHPUnit 9.5.2 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.1
Configuration: D:\NetBeansProjects\PHP\Saft-PT_4_php_EE\phpunit.xml
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'MasterFiles'
Time: 00:00.149, Memory: 6.00 MB
Test script:
---------------
public function testTest(): void
{
$document = <<<XML
<MasterFiles>
<Customer><CustomerID>CA1</CustomerID></Customer>
<Customer><CustomerID>RES</CustomerID></Customer>
<Customer><CustomerID>PP</CustomerID></Customer>
<Customer><CustomerID>CA3</CustomerID></Customer>
</MasterFiles>
XML;
$reader = new \XMLReader();
$reader->XML($document);
while ($reader->name !== "Customer"){ $reader->read();}
do{
echo \sprintf("Node name Should be 'Customer' and is '%s' \n",
$reader->name);
}while ($reader->next());
}
Expected result:
----------------
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is 'Customer'
Actual result:
--------------
Output of the above test:
PHPUnit 9.5.2 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.1
Configuration: D:\NetBeansProjects\PHP\Saft-PT_4_php_EE\phpunit.xml
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'Customer'
Node name Should be 'Customer' and is '#text'
Node name Should be 'Customer' and is 'MasterFiles'
Time: 00:00.149, Memory: 6.00 MB
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80755&edit=1