Hi internals
I'm opening the discussion for my RFC "Improve callbacks in ext/dom and ext/xsl".
RFC link: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
Kind regards
Niels
Hi
I'm opening the discussion for my RFC "Improve callbacks in ext/dom and ext/xsl".
RFC link: https://wiki.php.net/rfc/improve_callbacks_dom_and_xsl
Some question that I believe are not answered:
$xpath->registerPhpFunctions([
"foo" => ...
]);
$xpath->registerPhpFunctions([
"foo" => ...
]);
Is this an error due to the duplicate definition or will the last 'foo' win?
$xpath->registerPhpFunctions([]);
Is this an error or a noop?
Would it make sense to deprecate passing a string as "Future Scope"?
Simplifying the method signature would also allow to simplify the
documentation in the long run and registering a string is trivially
fixed by adding square brackets.
In fact looking at the existing documentation at
https://www.php.net/manual/en/domxpath.registerphpfunctions.php, what's
the difference between 'php:function()' and 'php:functionString()'?
Best regards
Tim Düsterhus
Hi Tim
Hi
I'm opening the discussion for my RFC "Improve callbacks in ext/dom and ext/xsl".
RFC link: https://wiki.php.net/rfc/improve_callbacks_dom_and_xslSome question that I believe are not answered:
$xpath->registerPhpFunctions([
"foo" => ...
]);$xpath->registerPhpFunctions([
"foo" => ...
]);Is this an error due to the duplicate definition or will the last 'foo' win?
The last 'foo' will win, such that you can override previous definitions.
$xpath->registerPhpFunctions([]);
Is this an error or a noop?
This is a no-op, just like it is the case in current PHP versions.
Would it make sense to deprecate passing a string as "Future Scope"? Simplifying the method signature would also allow to simplify the documentation in the long run and registering a string is trivially fixed by adding square brackets.
Maybe, although I personally don't hate it that much.
In fact looking at the existing documentation at https://www.php.net/manual/en/domxpath.registerphpfunctions.php, what's the difference between 'php:function()' and 'php:functionString()'?
The difference is in the returned result.
php:functionString() will case the result to a string automatically for you, while php:function() just returns the result as-is.
Best regards
Tim Düsterhus
Kind regards
Niels