Re: DOMXPath / XSLTProcessor function callbacks
| From: | Marc | Date: | Sun, 15 Oct 2023 10:53:39 +0000 |
| Subject: | Re: DOMXPath / XSLTProcessor function callbacks | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121321@lists.php.net to get a copy of this message | ||
Hi,
On 14.10.23 13:54, Niels Dossche wrote:
Hi Tim On 10/14/23 12:30, Tim Düsterhus wrote:As it's not clear what these functions do wouldn't it make more sense to introduce new / more clear functions and deprecate the old? Like: ->addXPathCallable(string $alias, callable $fn); ->getXPathCallables(): array<string, callable> ->removeXPathCallable(string $alias); And is it really necessary to be able to register all functions? Also what would happen in this case with functions included later? Would they also be callable or only the functions known at the point of registering?Hi On 10/13/23 00:39, Niels Dossche wrote:You can call both, it's additive.Please let me know your thoughts.What does calling ->registerPHPFunctions() do when it's called more than once? Will the existing allow-list be overwritten or amended? i.e. $xpath->registerPHPFunctions([ 'strtoupper', ]); $xpath->registerPHPFunctions([ 'ucfirst', ]); will I be able to: (a) Call ucfirst(), but not strtoupper() (b) Call both
Best, MarcBest regards Tim DüsterhusCheers Niels