#26987 [Fbk->Opn]: XML data extraction bug

From: Date: Wed, 21 Jan 2004 17:31:44 +0000
Subject: #26987 [Fbk->Opn]: XML data extraction bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-53705@lists.php.net to get a copy of this message
ID: 26987 User updated by: aeolianmeson at hotmail dot com Reported By: aeolianmeson at hotmail dot com -Status: Feedback +Status: Open Bug Type: XML related Operating System: WinXP PHP Version: 4.3.4 New Comment: I'm sorry-- your time is no longer needed. It turns out that it was a problem relating to a problem I have been having with key-value associative array pairs. Thank you for your time, Dustin Previous Comments: ------------------------------------------------------------------------ [2004-01-21 05:45:58] sniper@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-01-21 03:41:19] aeolianmeson at hotmail dot com Description: ------------ Using Expat XML functions. The character data handler will occasionally return only a first part of data. It will be immediately called again and return the rest. This bug only occurred around the 20th and 40th records in a dataset containing about 80. This occurred with multiple data-files where the consistency between records has been verified. Dustin Oprea, PHP-programming extraordinaire Sample: <logentry><date>2004.01.21</date><time>01:33:38</time><ip>127.0.0.1</ip><querystring>INSERT INTO residents VALUES (55, "Chambers", "Harveasha", '0', '0', '', '216', '')</querystring><position>backup.php/3</position></logentry> Reproduce code: --------------- // gets the last label recorded function getlabel() { global $stack; $tagname = array_pop($stack); array_push($stack, $tagname); return $tagname; } // character-data handler function havedata($parser, $data) { global $recorddata; $data = trim($data); if(strlen($data) == 0) return; $recorddata[getlabel()] = $data; } Expected result: ---------------- INSERT INTO residents VALUES (54, "Lewis", "Theresa", '0', '0', '', '215', '') TAG= position backup.php/3 TAG= logentry TAG= date 2004.01.21 TAG= time 01:33:38 TAG= ip 127.0.0.1 TAG= querystring --> INSERT INTO residents VALUES (55, "Chambers", "Harveasha", '0', '0', '', '216', '') TAG= position backup.php/3 TAG= logentry TAG= date 2004.01.21 TAG= time 01:33:38 TAG= ip 127.0.0.1 TAG= querystring INSERT INTO residents VALUES (56, "Pierrie", "Ghezell", '0', '0', '', '216', '') TAG= position Actual result: -------------- INSERT INTO residents VALUES (54, "Lewis", "Theresa", '0', '0', '', '215', '') TAG= position backup.php/3 TAG= logentry TAG= date 2004.01.21 TAG= time 01:33:38 TAG= ip 127.0.0.1 TAG= querystring --> INSERT INTO residen --> ts VALUES (55, "Chambers", "Harveasha", '0', '0', '', '216', '') TAG= position backup.php/3 TAG= logentry TAG= date 2004.01.21 TAG= time 01:33:38 TAG= ip 127.0.0.1 TAG= querystring INSERT INTO residents VALUES (56, "Pierrie", "Ghezell", '0', '0', '', '216', '') TAG= position ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26987&edit=1

« previous php.bugs (#53705) next »