Re: DOMXPath / XSLTProcessor function callbacks
| From: | Tim Düsterhus | Date: | Sat, 14 Oct 2023 12:42:18 +0000 |
| Subject: | Re: DOMXPath / XSLTProcessor function callbacks | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121309@lists.php.net to get a copy of this message | ||
Hi
On 10/14/23 13:54, Niels Dossche wrote:
Okay, for your suggestion (1) the following would work then? // Register all native PHP functions. $xpath->registerPHPFunctions(null); // Register additional callables. $xpath->registerPHPFunctions([ 'staticMethod' => ClassWith::staticMethod(...), 'classWithMagicInvoke' => new ClassWithMagicInvoke(), ]); I would not find that usage to be too unreasonable. Especially since allow-listing *all* of PHP's global functions would be pretty questionable (looking at eval() and all functions with side-effects). Best regards Tim Düsterhus(a) Call ucfirst(), but not strtoupper() (b) Call bothYou can call both, it's additive.