>
> I'm missing a thing here when we talk about "your code". I mean on our
> site we have third party libraries. They can typically have a release
> schedule on a couple of releases each year. So all code is not up to
> us to change. So how does this proposal adress that scenario when it's
> not up to us to do the necessary changes? Is it e.g. a blocker to
> upgrade to PHP 8.1 with exceptions vs warnings until the library is
> updated?
>
> As a side note I'm at the moment migrating our test site to PHP 8 and
> the two most prominent hickups are located in a third party library:
> "Undefined array key" and "Attempt to read property "value" on null"
> which are warnings. Not sure how it would have been with these as
> exceptions, e.g. would the test site stop running and thereby stop
> testing of other parts.
>
> And as I have said earlier, I do like exceptions! It's the migration
> aspect I'm wondering about...
>
> r//Björn L
>

This is a valid concern. I have thought about it for a while and I think
that we should handle this the same way we did with PDO error mode change.
We don't do anything special.

I really don't see a way that we could make a smoother upgrading
experience. For users that avail of old libraries the onus is on them to
check the library's compatibility with the new PHP version. Ideally, the
change should have been made in PHP 8.0 where it would be more justifiable
to change a default setting.

The good thing about mysqli error reporting compared to PDO is that the
setting is global. If the library you are using is abandoned or you can't
wait for the library to be updated then you can set the error reporting
level in your own code. The only problem comes when you want to mix both
modes in the same code, but that is a huge code smell anyway. This means
that this change is not a blocker for the upgrade.

I think the proposal is good to be implemented in PHP 8.1 as it is now. But
if anyone thinks otherwise or has any ideas on how to improve I would
gladly take it into consideration. If there is any way that we could make
the migration smoother then it would be great.

Kamil

Reply via email to