On February 27, 2021 5:23:47 PM GMT+01:00, Kamil Tekiela <tekiela...@gmail.com> 
wrote:
>>
>> The issue is, as said, that this only happens in an error situation.
>> Thus if users only test "does my site still work after update?" (what
>> many do ...) won't notice this, till something fails, which would
>have
>> been caught nice beforehand.
>>
>
>I don't see why this would be such an issue. If the code fails for any
>reason then an error is produced. The error might be surprising, but it
>is
>not something that would cause problems. In situations where the code
>depends on the silenced errors
> to work properly

The code shown here https://www.w3schools.com/php/func_mysqli_connect.asp is 
relatively correct at the moment. Maybe not nice, but it handles the error. 
That is the second hit on google (after php.net manual) when searching for "php 
tutorial mysqli_conect") Most other books, tutorials, ... teach the same.

> then the developers
>would
>know this and they would test for it during the upgrade.

That is true for the ones posting here and talking at conferences.
Spend a day looking at stackoverflow and you see a different world. Also many 
users just want to use a PHP app and don't care about PHP. In many cases some 
agency (which often have no idea about software development, but mostly care 
about the UI design and reaching a goal quickly) created an app and the users 
just want to run it and got an server with thestest version. This isn't nice, 
but it is a reality.

>This change fixes more problems than it creates. I believe it is still
>worthy to put it in 8.1.

It is true that more consistent error reporting via Exceptions would be better 
and solve many problems. These are the reminders of the "OO wars" we fought 
around the time of the PHP 4 - PHP 5 transition and I think it is great that 
many people are working on cleaning this up!

>  Every PHP release contains
>backwards-incompatible
>changes.

There is a balance we're always fighting about. There are cases where BC breaks 
are done and hopefully most of them explode loud. For instance of we add a new 
keyword. This emits and error quite quickly, a simple lint check is enough to 
find it. Just including the file will fail.

Here we are talking about a case where the break will only occur in an errorous 
situation. Which users will only spot when reading the upgrading guide 
carefully. In an area 99% of beginner tutorials and books touch.

> In comparison to other BC changes PHP has put in minor
>releases
>this one has a very easy fix. You don't have to scour the code looking
>for places to fix.

The fix is easy. Getting awareness is hard.

>PHP can't improve if we have to think of people who upgrade without
>reading
>the release notes. We also shouldn't be held back by outdated
>tutorials. In
>fact, this will help people who still use such tutorials. This isn't a
>major change that would affect everyone on the planet. This will only
>affect people who still use mysqli and didn't set the error reporting
>mode
>before upgrading.
>I understand your worries but I don't think this is a good enough
>reason to
>not go ahead with this change.

I am not about stagnating and not doing anything. As said: I think the idea is 
good. I am about thinking about the process and timing.

What about this approach:

In 8.1 add deprecation notices to mysqli_connect & friends AND to access to the 
connection_error (if I remember right that goes via the __get hook, thus we can 
add a deprecation note to a "property" access)

The later is a good place as many people use the @ operator on the connect, but 
not on the error check.

In a later version we change it.

That gives a chance to reach users. We will still miss many, but for a notable 
amount of people there is a chance.

johannes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to