Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128926 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 lists.php.net (Postfix) with ESMTPS id 5F1C21A00BD for ; Thu, 23 Oct 2025 08:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761207701; bh=VfEqrk/QOrM8VEHEVa3caB3P0Q0kto3Y60mjc4QvR+M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=T0sMG5MbzwqJNq+QyVkSeyV5DEpOWhFdUYEuDZwq6tiEgha7hYfxRe1tUCSeHzBL2 9hN4gy4zR0domNomz04Eog41aWWR7qG45zsLD4wIkpgB2kFk/g2/bt1HzIezbnwWRc U3A6sGfnv9gHa7frJb9GBNFMPugsbI0gVozrBGaCSyMtQ1Gy38gRFl/os0Vi0Jdngu nZEXAHyCC2NcrHbj2l9EI0QU92P5pLenLY+yq6OIp5TU5z2WS4/EKkqsjBdVvhJZL6 5WPwxtB8waOzBgw4jv+TxhzJsrxAqXdDOVhZ7OjcTB3wAyJIm/9TsmYfNK/y6qryL8 RGfoIjLnlx9jA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 432751804D9 for ; Thu, 23 Oct 2025 08:21:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 23 Oct 2025 08:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1761207692; bh=h+TGRJxX8DD5/7AIg1zivWkhUXnTw0O0o+6NCOxWtZU=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=YEHTBI1aPTq51qhgSXUBWUtBCnnQ+jicvaAtpTJsdR7YEscyFNxLcikR06tyW124g obECyLxRkX9NOTgHWOkt8fh+RHNniviv5nat3SySxzQ0aZP6QV+Tbfa38jU+eclA54 NBkbkpUxSUBAvt36LCwT8n88+7chU5rfR937fcU5SbYjV2bFtYE9GA29uRBx4w3JCc xn28VVIcMRqC9gJ6Q9lqt7UDQVRBCX7kCAN2OvP0gLDsRLY6xkR8EHI0TJSYY226oR 0J/pDFLsuBPLhP1LLMQ5k041qs8dOGASubWPMucrB0Wx/EIFBtDpZ3pcpJe02a5dIo RtnnYIrlQxYQw== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 23 Oct 2025 10:21:31 +0200 To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Deprecate Undefined Constant Usage in php.ini Files (GH-20060) In-Reply-To: <775eb41b-7d5b-4da6-8f31-834de92b4ac8@rwec.co.uk> References: <2abf50cd-5738-48e0-af15-a8c010141deb@bastelstu.be> <1760945334276.4002170669.2593555531@yahoo.de> <775eb41b-7d5b-4da6-8f31-834de92b4ac8@rwec.co.uk> Message-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-10-20 20:17, schrieb Rowan Tommins [IMSoP]: > I don't think this kind of pattern matching is the right way to go. > It's perfectly normal in INI files to have all sorts of strings which > aren't quoted; looking through the samples provided in the source, I > spotted this: > > user_agent=PHP > > No regex is going to recognise that that should be interpreted as > "PHP", not constant("PHP"). I agree with that. Supporting bare strings is a key feature and randomly warning for *some* of them is going to be even more confusing than just some of them randomly getting replaced by a different value just because they happen to match a constant. In fact this made me realize that `parse_ini_*()` is unsafe, because it doesn't just support *internal* constants, but also constants defined in userland. I have thus just proposed a new warning to be added to the documentation: https://github.com/php/doc-en/pull/4946. Given that the primary purpose of the constant support seems to be the E_* constants for `error_reporting`, it might be best to instead only support a small allow-list of safe constants in INI files. Best regards Tim Düsterhus