#50576 [NEW]: XML_OPTION_SKIP_TAGSTART option has no effect
| From: | pgacv2 at gmail dot com | Date: | Sat, 26 Dec 2009 05:16:44 +0000 |
| Subject: | #50576 [NEW]: XML_OPTION_SKIP_TAGSTART option has no effect | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-146113@lists.php.net to get a copy of this message | ||
From: pgacv2 at gmail dot com
Operating system: Ubuntu 9.10
PHP version: 5.2.12
PHP Bug Type: XML related
Bug description: XML_OPTION_SKIP_TAGSTART option has no effect
Description:
------------
I'm actually running PHP 5.2.10 (that came with Ubuntu 9.10), but I can't
compile a newer snapshot because my system suffers from bug
https://bugs.launchpad.net/ubuntu/+bug/81057
and the make install hangs
when trying to fetch http://pear.php.net/install-pear-nozlib.phar.
But
there's nothing in the bug database with "XML_OPTION_SKIP_TAGSTART," so
maybe no one's noticed this one before.
Setting XML_OPTION_SKIP_TAGSTART through xml_parser_set_option($parser,
XML_OPTION_SKIP_TAGSTART, $x) has no effect. Instead of skipping $x number
of characters from the beginning of the tag name (like to remove a
namespace), it leaves the tag name whole.
Reproduce code:
---------------
test.xml:
<?xml version="1.0"?>
<ns1:listOfAwards xmlns:ns1="http://www.fpdsng.com/FPDS">
<ns1:count>
<ns1:total>867</ns1:total>
</ns1:count>
</ns1:listOfAwards>
Code:
<?php
function startElement($parser, $tagName, $attrs) {
echo "$tagName\n";
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, 'startElement', '');
xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
if (!($fp = fopen('test.xml', 'r'))) {
die('could not open XML input');
}
while($data = fread($fp, 4096)) {
if(!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
?>
Expected result:
----------------
LISTOFAWARDS
COUNT
TOTAL
Actual result:
--------------
NS1:LISTOFAWARDS
NS1:COUNT
NS1:TOTAL
--
Edit bug report at http://bugs.php.net/?id=50576&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50576&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50576&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50576&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50576&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50576&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50576&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50576&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50576&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50576&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50576&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50576&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50576&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50576&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50576&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50576&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50576&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50576&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50576&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50576&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50576&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50576&r=mysqlcfg