Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121310 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92367 invoked from network); 14 Oct 2023 15:14:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Oct 2023 15:14:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C265F1804D0 for ; Sat, 14 Oct 2023 08:14:24 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 ; Sat, 14 Oct 2023 08:14:24 -0700 (PDT) Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-9bda758748eso212723566b.2 for ; Sat, 14 Oct 2023 08:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697296463; x=1697901263; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=w2J3yDzJH37gwEEh1dOtsyTykx6/iPnqtE4LKLDJ4OA=; b=FKogJ8qDhmJ58dvvJ+JLlZaEHK1fgGHiJk4lwedVX9zfXE45jN3dW3993gr2yC2AbV Tk/n1Y9yVOD74jX6gtkCcWyRJ7319Vlp8h3JaZES+fqs/w53YNmOPPljs5WIU/DIw5Wa DSK5kdYLHBV9IBEiHzYxrAeU3UPt/743BsR9RbPN4E7H5IASzVsjSN1sdcqHJ71r+47N UJXLQI76gVPeRvbNWfgoQz1sMv+Lr5hq6Ln0ABiZGYREo4NlcEWhhE2ON7kescfXz2TB W09c1y29ifu9d+WmdXuov4y9l0iJcO4oYpnMM21p8KdabLet2ARf9ElkewUamTe8S6Xb 0L8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697296463; x=1697901263; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w2J3yDzJH37gwEEh1dOtsyTykx6/iPnqtE4LKLDJ4OA=; b=fW9awBJdpNIVby+ycIyHHuJ2csNKfe384HmNGf5U97LasAPMZFGUexiJ7yU/xQn318 2wzPoKQcQa1INqJ1GQQSLMn8kNRXs9m1esWHGfKN56NcAb51++1IvE82Sw33LdJhu7f0 VrfYUbETZx39iJRudtZKv/WmfwtP1KnV8EbuzjCJtMGmtf2B4yvO5miLDV9dEMnrQkSJ 74jmzouOd1j9qex7Y5YXVCx8KnKQnYT628FbD7hIA9BSMJIoAZP2pGibGdp0tMEW3qSU erXQ4sjaMa+qqcv119TPZZVyktu4934qtRTT61YyBAH7RvSSPUAzMFj+Jta+gA+TFn0F fSXg== X-Gm-Message-State: AOJu0YwfgZ+LHESwvZxwTB1ARI1Es8GcDHZVbcwlTKC8r3wMZd8WD9o3 CjYTmpNcC5Nm7BVW5/2yC4BLh5fa1iI= X-Google-Smtp-Source: AGHT+IGF1L9zZ9JZyQw7WXjWTB7d5jXZy8hvA1wKRYZevus9h+/BmkEDo+KqfUST4Eg+alnkcL5AiA== X-Received: by 2002:a17:906:3289:b0:9ae:3e72:7c72 with SMTP id 9-20020a170906328900b009ae3e727c72mr23689644ejw.58.1697296462563; Sat, 14 Oct 2023 08:14:22 -0700 (PDT) Received: from [192.168.0.59] (178-117-137-225.access.telenet.be. [178.117.137.225]) by smtp.gmail.com with ESMTPSA id c27-20020a170906d19b00b009b64987e1absm1031392ejz.139.2023.10.14.08.14.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Oct 2023 08:14:21 -0700 (PDT) Message-ID: <229c8f26-0090-477c-ad7c-c7a7f8fac659@gmail.com> Date: Sat, 14 Oct 2023 17:14:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: PHP internals References: <0e6ee882-472f-43e1-822e-c156d9048e0c@gmail.com> <75d8452e-23ad-4943-b5da-63fdc85c24a0@bastelstu.be> <6765d47f-7f6b-436e-b2c9-d98f675905b0@gmail.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] DOMXPath / XSLTProcessor function callbacks From: dossche.niels@gmail.com (Niels Dossche) Hi Tim On 10/14/23 14:42, Tim Düsterhus wrote: > 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(), > ]); Yes this would work. > > 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). That's a fair argument, allowlisting all would indeed be not very defensive programming. Thanks for your input. > > Best regards > Tim Düsterhus Cheers Niels