On Tue, Feb 4, 2025 at 12:10 PM Derick Rethans <der...@php.net> wrote:

> What's the reason why this emits a warning though, instead of throwing
> an Exception? I'm sure you thought of it, but it would be nice to have
> that consideration mentioned in the RFC.
>

Thank you for the question, I now added the missing reasoning to the RFC
text.

> A <php>E_(USER_)WARNING</php> was chosen over an exception to avoid BC
concerns, as throwing would potentially break existing code that "works as
implemented" and because this is only a warning in the literal sense of the
word, given that the function executes successfully.

Given that PHP uses Exceptions only in hard failure cases, we found it to
be more prudent to go this way. If users really want, they can
suppress/ignore this warning without adapting existing code, e.g., using
the proposed (void) cast. But the main reason was to not cause hard
failures through exceptions.

Kind Regards,
Volker

-- 
Volker Dusch
Head of Engineering
Tideways GmbH
Königswinterer Str. 116
53227 Bonn
https://tideways.io/imprint

Sitz der Gesellschaft: Bonn
Geschäftsführer: Benjamin Außenhofer (geb. Eberlei)
Registergericht: Amtsgericht Bonn, HRB 22127

Reply via email to