Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121309 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84029 invoked from network); 14 Oct 2023 12:42:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Oct 2023 12:42:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3B1FA1804D0 for ; Sat, 14 Oct 2023 05:42:21 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 14 Oct 2023 05:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1697287339; bh=kQ6u3o9wiAhXl2MWa6zNd44QwZ54SAvgWIPnwvvZxyo=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=BUN/ZbAzkJAKCo8WakptWOxsKbr1ldLfQ1X5Wsu/0Q2EnEIshlw0NLsZg4EWxs4wP U2N3b9y516yIBsOJdnoCfj3rT15t73NEtyPWamcBu20w/jJZJ6UWzzcCdVOzU46Z/y FRyjfq2Tr6LXEAdiu8uutHVWFTPzk+Srkb67DhDt1IYcmW4qNYhhADu3Nbi6UN9lN+ jWVUx0vPB0EC2rTDu3gbHrN/6zmEvZT8PJQYa9C1k9R3281bqQiRanl7aYE4U75WO0 nVFWf13BZTBljkfMwdb+6pqcz8aZF5lf1NNIiKKoHY1lqJJLq65vOijib2Y9+dnHTL h+djBBNbnkvaA== Message-ID: Date: Sat, 14 Oct 2023 14:42:18 +0200 MIME-Version: 1.0 Content-Language: en-US To: Niels Dossche , PHP internals 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> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] DOMXPath / XSLTProcessor function callbacks From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 10/14/23 13:54, Niels Dossche wrote: >> (a) Call ucfirst(), but not strtoupper() >> (b) Call both > > You can call both, it's additive. > 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