php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #27180 Callback parameters in xml_set_*_handler
Submitted: 2004-02-07 11:15 UTC Modified: 2004-09-17 14:59 UTC
From: drm at melp dot nl Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.3.4 OS: Windows XP
Private report: No CVE-ID: None
 [2004-02-07 11:15 UTC] drm at melp dot nl
Description:
------------
Apache hangs when callback parameters are defined in an array (obj& obj, string methodName) form.

I suggest the documentation type hints are changed from
xml_set_*_handler ( resource, callback, ... )

to
xml_set_*_handler ( resource, string ...)

since the an array ( ... ) notation for callbacks should be correct according to http://nl.php.net/manual/en/language.pseudo-types.php

Note that it does the parsing until some point at the end of the XML document. I can't quite reproduce where exactly it hangs, but i think its the cleaning up part of the parser when the parsing is done (the $final of xml_parse must be true to reproduce this)

or you could fix the bug, of course :P



Reproduce code:
---------------
xml_set_element_handler ( 
   $this->parserResource, 
   array ( &$this, 'startElementHandler' ),
   array ( &$this, 'endElementHandler' )
);


Expected result:
----------------
don't hang apache ;)

Actual result:
--------------
hangs apache, (99% cpu), probably an endless loop?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-07 13:49 UTC] nlopess@php.net
is this really a doc problem??
 [2004-02-07 13:57 UTC] drm at melp dot nl
I'm not sure. The documentation is not quite clear about not passing that type of callback functions to those functions. If the docs would be clear about that, there wouldn't be a problem (imho)

Also, a special function 'xml_set_object' is available for this kind of callbacks, so i figured there are no plans on letting xml_set_*_handler functions handle the obj/method callbacks.

That's the reason i posted it as a documentation problem. If the dev team would rather consider it a bug, that's even better :) Sorry if that puzzled you.
 [2004-09-17 14:59 UTC] vrana@php.net
According to xml_call_handler() function in php-src/ext/xml/xml.c, array in callback should work. If it doesn't, reopen this bug and reclasify it as XML related (it's quite a long time from the bug report so it is maybe fixed).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 09:01:32 2024 UTC