|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30061 xml_set_start_namespace_decl_handler not called
Submitted: 2004-09-11 00:06 UTC Modified: 2004-11-18 21:17 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jw at jwscripts dot com Assigned:
Status: Closed Package: XML related
PHP Version: 5.0.2 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
11 + 24 = ?
Subscribe to this entry?

 [2004-09-11 00:06 UTC] jw at jwscripts dot com
The namespace handler defined with the xml_set_start_namespace_decl_handler() function is never called.

Reproduce code:

$xml = '<addressbook xmlns:ab="" />';

$parser = xml_parser_create_ns();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);

/* The handler doesn't get called for some reason */
xml_set_start_namespace_decl_handler( $parser, "NSHandler" );

xml_set_element_handler( $parser, 'StartHandler', 'EndHandler' );
xml_parse( $parser, $xml, true);
xml_parser_free( $parser );

function StartHandler( $parser, $name, $attrs ) {
   print( "StartHandler Called<br/>" );

function EndHandler( $parser, $name ) {
   print( 'EndHandler Called<br/>' );

function NSHandler( $parser, $prefix, $uri ) {
   print( 'NSHandler Called<br/>' );

function DefaultHandler( $parser, $data ) {
   print( 'DefaultHandler Called<br/>' );

Expected result:
NSHandler Called
StartHandler Called
EndHandler Called

Actual result:
StartHandler Called
EndHandler Called


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-11 00:14 UTC] jw at jwscripts dot com
This bug seems to be related to bug #27908
 [2004-09-25 13:26 UTC] jw at jwscripts dot com
Problem persists in version 5.0.2
 [2004-11-18 21:17 UTC]
This bug has been fixed in CVS.

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.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 23 16:03:36 2021 UTC