|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50576 XML_OPTION_SKIP_TAGSTART option has no effect
Submitted: 2009-12-26 05:16 UTC Modified: 2010-01-05 13:04 UTC
From: pgacv2 at gmail dot com Assigned:
Status: Closed Package: XML related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pgacv2 at gmail dot com
New email:
PHP Version: OS:


 [2009-12-26 05:16 UTC] pgacv2 at gmail dot com
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 and the make install hangs when trying to fetch 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:
<?xml version="1.0"?>
<ns1:listOfAwards xmlns:ns1="">

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',

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-26 11:48 UTC]
Happens to all versions.

Btw, use --disable-pear if you don't need it (for testing php only).
 [2010-01-05 13:03 UTC]
Automatic comment from SVN on behalf of pierrick
Log: Fixed bug #50576 (XML_OPTION_SKIP_TAGSTART option has no effect).
 [2010-01-05 13:04 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2010-02-03 18:35 UTC]
Automatic comment from SVN on behalf of pajoye
Log: - Fixed bug #50576 (XML_OPTION_SKIP_TAGSTART option has no effect).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 23:01:31 2024 UTC