doc-en
doc-en copied to clipboard
Contradiction in xml_set_default_handler() docs
From manual page: https://php.net/function.xml-set-default-handler
It says:
Description xml_set_default_handler(XMLParser $parser, callable $handler): bool
Ok so $handler
is a callable. We all know what a callable is: either a string which is the name of a function, an [$object, 'methodName']
pair, or an anonymous function definition.
But then it says:
handler handler is a string containing the name of a function that must exist when xml_parse() is called for parser.
Wait, so must it be a string? Or is this just a leftover from an older version when callables didn't exist and it actually had to be a string with a function name?
Looks like a leftover: I don't see it requiring a string, just a generic array/object/stringable value.
But I do see that it accepts any array/object/stringable value for that handler, meaning it hasn't switched to more modern support that only allows valid callbacks. https://3v4l.org/0kBnZ
Yeah, that code could need some TLC.
I'm going to look into the C code to improve it and will handle the docs at the same time.
Similarly, xml_set_element_handler etc say stuff like "The function named by