Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128766 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 F2C4E1A00BC for ; Thu, 2 Oct 2025 08:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1759392862; bh=EzaqJH+MSGe3Z5U0Ff4JkfroDH9mA5NZz9gxpSqSwRg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ez141JhIRvR7YAiQzoslMr2oIIs/P/mhszbqjyBymx4vX36lfT2n7INPFxTat1WVr I4QG9bVKdakpTzXEIZ8/lsOUXR90gearuqZPuQjd2Tm+FEeRFl3XUI13PRWTifh/44 saHvETpiGKYZ2pr9cMqCImk3poZB6g1ldu5YAqfEo3b4qB5tNkdjCK/hBO6JCt8Cy+ SDhCQpDAYnTdvnxbbS/WMdvpsJNyknsU0kITShUbgoiW67uUfuzHcL4456NpSrKtpM HW4rixKsZjSk+Ma5dew77vVjBGZcvi2GjbDd4DBXt/t8oYXpHbSDrXPQwlljxAY3Kc RPZ3S5mz35O7w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 32A08180062 for ; Thu, 2 Oct 2025 08:14:19 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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, 2 Oct 2025 08:14:18 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-6364eb29e74so1591919a12.0 for ; Thu, 02 Oct 2025 01:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759392936; x=1759997736; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EzaqJH+MSGe3Z5U0Ff4JkfroDH9mA5NZz9gxpSqSwRg=; b=FPP764WPZjlpGuHYPvVD/kM0d3cvTFQ5FXTHv+YJrbCA1xFJZSEULX2kMWm8ZS3iYi fOmrao9CfcvA9j9cvLwYs+Ifh/SggZb6HNpKGoMCLmdVHEV9Z9rTUOQAQ1joTHg8FNMN OohSbnxvuIHQkdLY8JOVEetIA0Y2S6vcHd4U0FWj/V8r2dgbRsbWoXu+RreMm5lRIy0B Q3QK8HU20ByXv22aUNlhOPf7yYCs+B+kg3r0zQpV/foNn5v7AWETGM7ULBO6vJ8n/Xn7 gjCNjsLtMkLSqADrm/Klbkx89J6/kEnFtwJYPO2PBNH23FpsmgpcUo37UOUdggWGMRsa LSDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759392936; x=1759997736; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EzaqJH+MSGe3Z5U0Ff4JkfroDH9mA5NZz9gxpSqSwRg=; b=Hd9W6HxrZZseopfnailrfIieQJI8aSPA+ZzKwG94mvOxMe8d14t0SufKdXtRUGPoO+ PO6GPPyeWsww4VuUL+jylqkrYIKr9bpwk23TTumVZvliK9LI7dxVKT8dxp7je0h6Zt6d VVp+B73VuwD5p+OfCv7euxmtsuAAswBH4jO5ou3pZ5/mEhlncQWhOauY4l43cNgWasfB uBmAR4TvZBYj7obhJn5hpKBKU0hdRd0X+DILRamwbAhueo3s0k7+Do8MGm2hl6wrd8JN Q9L4XuhlFIXE8ILxxQb+zLEc2tYgZU1UxzzNQAojwwNOw+O2MeIDO1bGbPoYwCb02lV0 2W3A== X-Gm-Message-State: AOJu0Yx5cSq6jxHErSSmTRFsKc95mkky+7kIKSv4Iju0kgbbTB0lJWfZ O6wtBZaOdP7ouHnf4b8bI74F+QqPf4EQZuo5tm/yd07GZCbqSY5Y5wAkmV4RpVpGApQ9zx6AhGI gNQHPKvnTd2Ou8f/PICgjWASGUMSzvkqhDg== X-Gm-Gg: ASbGncsWuVBzCXNIlNVnQibj6Prbt9b+3QCHtuahUKInkatZfqaGcDrEkNQjkmt5LND 0ao4xOCl9hQJZnrg7RA65ceqg/2z0zFqEcTrGTQ2G9cKYrlRlabB5a+HTYe3pNsKzRUZS0boI7z NuZTo9gDz0kivTGQMIJAIh27wXph57UeJzdOOEdIy+9V3Yl+83sdjr5BeY7JyHlwwZSM2jYYyqB QUdTAhOa6/2957UPSlDaslYvSCnh4QqyvqwTBUGMBsfBZz5gUHjErQfWQe/YXFC X-Google-Smtp-Source: AGHT+IFyFF4Sa5vGgofDiSGgrzObJ4bN7GqgpQ/Aycge42W2XJUqDKAPbYxhiaHVSBOG+zPijnQUSEV9l6qW4Bkt27I= X-Received: by 2002:a05:6402:4306:b0:62f:9731:a1c6 with SMTP id 4fb4d7f45d1cf-63678ce6b10mr6595067a12.21.1759392935819; Thu, 02 Oct 2025 01:15:35 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <68DD64BE.5080308@adviesenzo.nl> In-Reply-To: <68DD64BE.5080308@adviesenzo.nl> Date: Thu, 2 Oct 2025 10:15:23 +0200 X-Gm-Features: AS18NWCWx-YEys1y2IeXbd1Lz_08GUQC3jA23KJQeIXAjvyC6ioPBaUKSP-9kAg Message-ID: Subject: Re: [PHP-DEV] [DISCUSSION] Validating regex pattern To: Juliette Reinders Folmer Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: alex.daubois+php@gmail.com (Alexandre Daubois) Hi, > Historically, PHP supported three regex engines (POSIX, PCRE, Oniguruma).= The POSIX engine was dropped in PHP 7.0 and there is a draft RFC to drop s= upport for Oniguruma [1], however, that still means that at this time PHP s= upports two different regex engines, which each have their own criteria for= when a regex is a valid pattern, and for Oniguruma supports a multitude of= regex dialects [2]. I wasn't aware of that. Thanks for the info! > It also makes the `FILTER_VALIDATE_REGEX_PATTERN` flag highly ambiguous a= s it is unclear against which engine/dialect the regex would be validated. Indeed, the multi-engine "issue" makes it clear that it would be ambiguous. > Maybe the error code flags returned via `preg_last_error()` [4] should be= made more specific to allow for detecting when a regex function failed due= to an error in the regex. > Maybe the extensions should get a "throw on invalid regex" option, either= via an ini flag, a new function parameter or via an existing function like= `mb_regex_set_options()`. I like the first solution, I like the second one even more. It would be aligned with JSON_THROW_ON_ERROR. > I'm not sure what the best solution is, but going with an illogical solut= ion just to try and avoid the RFC process is not the way to go IMO. The purpose isn't to avoid the RFC process, I'll write one if necessary. I just want to gather opinions and deduct if it's necessary :) =E2=80=94 Alexandre Daubois