Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113309 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62600 invoked from network); 27 Feb 2021 17:42:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Feb 2021 17:42:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 12ECD180504 for ; Sat, 27 Feb 2021 09:31:45 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,SPF_HELO_PASS, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail.toneristzuen.de (mail.toneristzuen.de [84.19.169.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 27 Feb 2021 09:31:44 -0800 (PST) Received: from Galaxy-S20.fritz.box (ppp-188-174-55-8.dynamic.mnet-online.de [188.174.55.8]) by mail.toneristzuen.de (Postfix) with ESMTPSA id 668CE425F4; Sat, 27 Feb 2021 18:31:40 +0100 (CET) Date: Sat, 27 Feb 2021 18:31:37 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: <84a86f15-313e-1fb3-eb09-7fd6bbdeb5ce@php.net> <821813eb972cd5dad30a0e10385a115a9a8908a2.camel@schlueters.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: Kamil Tekiela CC: Sebastian Bergmann ,PHP internals Message-ID: Subject: Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode From: johannes@schlueters.de (=?ISO-8859-1?Q?Johannes_Schl=FCter?=) On February 27, 2021 5:23:47 PM GMT+01:00, Kamil Tekiela wrote: >> >> The issue is, as said, that this only happens in an error situation=2E >> Thus if users only test "does my site still work after update?" (what >> many do =2E=2E=2E) won't notice this, till something fails, which would >have >> been caught nice beforehand=2E >> > >I don't see why this would be such an issue=2E If the code fails for any >reason then an error is produced=2E The error might be surprising, but it >is >not something that would cause problems=2E In situations where the code >depends on the silenced errors > to work properly The code shown here https://www=2Ew3schools=2Ecom/php/func_mysqli_connect= =2Easp is relatively correct at the moment=2E Maybe not nice, but it handle= s the error=2E That is the second hit on google (after php=2Enet manual) wh= en searching for "php tutorial mysqli_conect") Most other books, tutorials,= =2E=2E=2E teach the same=2E > then the developers >would >know this and they would test for it during the upgrade=2E That is true for the ones posting here and talking at conferences=2E Spend a day looking at stackoverflow and you see a different world=2E Also= many users just want to use a PHP app and don't care about PHP=2E 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 ap= p and the users just want to run it and got an server with thestest version= =2E This isn't nice, but it is a reality=2E >This change fixes more problems than it creates=2E I believe it is still >worthy to put it in 8=2E1=2E It is true that more consistent error reporting via Exceptions would be be= tter and solve many problems=2E 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 g= reat that many people are working on cleaning this up! > Every PHP release contains >backwards-incompatible >changes=2E There is a balance we're always fighting about=2E There are cases where BC= breaks are done and hopefully most of them explode loud=2E For instance of= we add a new keyword=2E This emits and error quite quickly, a simple lint = check is enough to find it=2E Just including the file will fail=2E Here we are talking about a case where the break will only occur in an err= orous situation=2E Which users will only spot when reading the upgrading gu= ide carefully=2E In an area 99% of beginner tutorials and books touch=2E > In comparison to other BC changes PHP has put in minor >releases >this one has a very easy fix=2E You don't have to scour the code looking >for places to fix=2E The fix is easy=2E Getting awareness is hard=2E >PHP can't improve if we have to think of people who upgrade without >reading >the release notes=2E We also shouldn't be held back by outdated >tutorials=2E In >fact, this will help people who still use such tutorials=2E This isn't a >major change that would affect everyone on the planet=2E This will only >affect people who still use mysqli and didn't set the error reporting >mode >before upgrading=2E >I understand your worries but I don't think this is a good enough >reason to >not go ahead with this change=2E I am not about stagnating and not doing anything=2E As said: I think the i= dea is good=2E I am about thinking about the process and timing=2E What about this approach: In 8=2E1 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=2E In a later version we change it=2E That gives a chance to reach users=2E We will still miss many, but for a n= otable amount of people there is a chance=2E johannes