Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124722 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id F098E1A00B7 for ; Fri, 2 Aug 2024 17:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722621097; bh=ur/a+/EtLQCK/mWvCH5WbRdRrOOoyKtWT/9nKP31iU8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=PIVIo1Mk3s2j8kw3cRfzRi2eFa3VoNd4S+Vw5MN1zM2uUo+LARzjn00+zXkpZ2cVz H2NQZ58sKZI4JtCLY2TYxk27MJrvhmGaHzkt/3jKO60yuXOD7tawTJ6QyMyCyf/i+K LaEUlSlvywv5moPghQJgp8VuOHzdlUPPQ3nno9/2Js3wLJF5T7OAAAq06k8dQTVrr9 q78ePxqY+3LQbLC51EJjvKSwpdIx3yNEjNNNuvQngHxD4EvKEgqgCKmetwVNuqdF6p i38fK8xTK8Jr/O0EfhHIB9zyqt7oLnqo9BDd3s0czzaoGN9udH/pai4YqQeLu38TdQ icOLnS8OM7Chw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 99D20180081 for ; Fri, 2 Aug 2024 17:51:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 2 Aug 2024 17:51:35 +0000 (UTC) Received: from [192.168.178.22] ([195.52.27.30]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1N5VPg-1sCVgm2bhC-017BLY for ; Fri, 02 Aug 2024 19:49:54 +0200 Message-ID: Date: Fri, 2 Aug 2024 19:49:54 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) To: PHP internals References: Content-Language: de-DE-frami, en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:Mgfaa1rtf67GPgOLQIYwtPn4DHtN6VnujLmYAP0IG10WYHiuy4g 3r6+5pL6FpaWkG9sBs0lVIFivLw3q18/zG2KTrt56do0yIj81YP9KRBaq6wuGZOdnPGTWOA QcmUgXp5tG6odGHENB3qKORw/w7EgYsEvujocYl79ChT2Zx5VNhx/cx6YBjPSJRIqrEenx8 TWm7thdcb7ecHtC4ydXhQ== UI-OutboundReport: notjunk:1;M01:P0:VsDIsUONylU=;StPefbSI0xmkuDCXtYk6NJMm/Mx AQeo5eGhfnLzh+PqLBWdqRagCFcoMPtVt5xNJX/nBk3nVFfZbe/C1rezS8zNJ/RmIuI2YwVru yw7FN0v7lfmmnoGl0YoFbxZ7df1SP28iUVeQKet8mRE7Q0+uEZfFhXtynl+r9kziLbU4HBm+7 YVB23dm2IFSOwx0+Q+KFAyX0MCrmVhmaMePSwhRQPaRqvasxXZTzoe9ZjUrmbbZkoR8RCZ0Vd vJ5blkIRDGcpTfVZuybXX2xf7j5uneqtsjf8RFghbRmuiK+pGK1wPv9rHtvkD3yoeDYlM7ru2 C0mmwAz2sgr+z2tV6RcaJ2ebX296Zbypk+vOHxQmB+Qo4mIbAAypSW6YTmfec1wxEpGseJdK9 TLgL599aLu/7ZpZoITMHDxdRobANiZH5MnScwBjXezKp7JD5UFl1khthe0VtXC9JCnY17uNRw /KylTrfkTMowsAhj1PB8S11ZDx99+d+Ed+zlN9HaQTyeI3xWgAYzdn4OVDi/2cOl/z7hLosyH L5Ve/Rkub+FQxs9Kr4L2lvPdtCmbDR8jLsd9woQDM/DrBtp0zZuwzuWNtnvHeyiNklKEFODE+ 0IW0W5/xIAvut8XVL1C/FnEyt55u2vmAfp5favM7tuO1t6Rb4C2mvmghC53aSihamCZpWacFV 3NmDsc9EarPwREcPM5AI27n6JsxIladoHMp4nOmQ95cqLB6XkNXB/5CGDzOHs/up4PvWWeq8s LqqfGRfXgHqGDGnaoKyn9SobOKAJwb0ug== From: thomas@nunninger.info (Thomas Nunninger) Hi, Am 02.08.24 um 18:51 schrieb Ilija Tovilo: ... > There are a few noteworthy downsides: > > * Unqualified calls to functions in the same namespace would be > slightly slower, because they now involve checking global scope first. > I believe that unqualified, global calls are much more common, so this > change should still result in a net positive. It's also possible to > avoid this cost by adding a `use function` to the top of the file. > * Introducing new functions in the global namespace could cause a BC > break for unqualified calls, if the function happens to have the same > name. This is unfortunate, but likely rare. Since new functions are > only introduced in minor/major versions, this should be manageable, > but must be considered for every PHP upgrade. > * Some mocking libraries (e.g. Symfony's ClockMock [5]) intentionally > declare functions called from some file in the files namespace to > intercept these calls. This use-case would break. That said, it is > somewhat of a fragile approach to begin with, given that it wouldn't > work for fully qualified calls, or unnamespaced code. Similar to Symfony's ClockMock this "feature" was propagated some years ago to e.g. intercept calls to the file system when running tests where the application was not designed with test-ability in mind. Regards, Thomas