Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121321 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55216 invoked from network); 15 Oct 2023 10:53:43 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Oct 2023 10:53:43 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B4C841804AC for ; Sun, 15 Oct 2023 03:53:42 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS34011 80.237.132.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wp160.webpack.hosteurope.de (wp160.webpack.hosteurope.de [80.237.132.167]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 15 Oct 2023 03:53:41 -0700 (PDT) Received: from [2a02:8109:b323:1700:e5f9:7932:39d4:19d7]; authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1qrykd-0001Tp-Pm; Sun, 15 Oct 2023 12:53:40 +0200 Content-Type: multipart/alternative; boundary="------------7Wp4xuKw7rx8fBqhVUQ5EHwd" Message-ID: <055fd91e-743a-432c-a5ad-384a4b0f1f50@mabe.berlin> Date: Sun, 15 Oct 2023 12:53:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: internals@lists.php.net References: <0e6ee882-472f-43e1-822e-c156d9048e0c@gmail.com> <75d8452e-23ad-4943-b5da-63fdc85c24a0@bastelstu.be> <6765d47f-7f6b-436e-b2c9-d98f675905b0@gmail.com> In-Reply-To: <6765d47f-7f6b-436e-b2c9-d98f675905b0@gmail.com> X-bounce-key: webpack.hosteurope.de;marc@mabe.berlin;1697367222;ef2d2348; X-HE-SMSGID: 1qrykd-0001Tp-Pm Subject: Re: [PHP-DEV] DOMXPath / XSLTProcessor function callbacks From: marc@mabe.berlin (Marc) --------------7Wp4xuKw7rx8fBqhVUQ5EHwd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, On 14.10.23 13:54, Niels Dossche wrote: > Hi Tim > > On 10/14/23 12:30, Tim Düsterhus wrote: >> Hi >> >> On 10/13/23 00:39, Niels Dossche wrote: >>> 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 > You can call both, it's additive. 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 ->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? >> Best regards >> Tim Düsterhus > Cheers > Niels Best, Marc --------------7Wp4xuKw7rx8fBqhVUQ5EHwd--