Re: [PHP-DEV][PRE-RFC] PREG_THROW_ON_ERROR flag

[email protected] (Osama Aldemeery) Fri, 10 Jul 2026 05:41:12 +0300
Newsgroups php.internals
Message-ID <CABE7Eu8Efqixk-HE2tT1BpP+SPmjQTq3ZXYCDROOGNWJ0tWyYA@mail.gmail.com>
Hi Tim,

> Pcre\PcreException would technically be fully in line with the naming
> and Throwable policy, by including the extension name as the prefix.
> However the existing PCRE functions use `preg_` as a prefix, it will
> probably be confusing to have the two different prefixes here. Given
> that, I would suggest going with an unnamespaced \PregException for now
> and then only introduce a namespace when actually building a new API to
> not paint us into a corner already.
>
> The naming policy specifically allows for that:
>
> > When adding new symbols to existing extensions it is RECOMMENDED to be
> > consistent with existing symbols, rather than to follow the namespacing
> > guidelines.
>
> and
>
> > Newly introduced extensions MUST follow the following rules, existing
> > extensions SHOULD follow the rules for newly introduced exceptions, but
> > MAY diverge for consistency with existing symbols.

I'd missed that entirely...thanks for the pointer!
And I think your reasoning about `\PregException` makes sense, I'll
switch to that.

Thanks,
Osama