Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103533 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58527 invoked from network); 29 Nov 2018 15:25:22 -0000 Received: from unknown (HELO mout.gmx.net) (212.227.15.15) by pb1.pair.com with SMTP; 29 Nov 2018 15:25:22 -0000 Received: from [192.168.2.102] ([79.222.37.159]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MRFwV-1fxmzA49pH-00Uc07; Thu, 29 Nov 2018 12:49:28 +0100 To: Dan Ackroyd , =?UTF-8?Q?Micha=c5=82_Brzuchalski?= Cc: PHP internals References: Message-ID: <5116704f-a944-f7e6-dbef-8e5a79c40b88@gmx.de> Date: Thu, 29 Nov 2018 12:49:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:zGv/IpalG9EwH3uK0mkjMZUXKQPkn+Rnda8YqZTjIe4HRjTeer4 kdsGcK8gyP/0lpH3TnBpnDkydy3wTzBUY1eskQxrYmxl9daZB5UrLaXo7apIKh5U+38Xl9o QTHaBhybAEEBKv/urvIPHEUSoQyfTVWu4RwZwYibR5S6ZMw6DDRXfsnXT7Q4sv5QoptPJlf NTBf+FV1Xzn9nSryjJ6XA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:dN11oz/GsqU=:6mHUXsi0Ulr1tflbIG2UA5 vPN2+94ArEBKtDVqA41xV3wceVBfiZ+YjRFLbIpj7TEJMZp04fp45r7z+FB4jm7JPKN8GMj28 BSNBpMkXNCdftZWewGrTAeqP8/GBVpguexTx2xG4UGmagMb93opnkuaAl/8tJZhredfciqfO4 kGS1gqdx3S0Q4ukMS2W6vEvXMVswJSDFC4cA+y9kQbaQ6N3VWyRppkldSH3+QYxuAbYr122jC 0q2aRwrKCUQPRh/RdD9O1S8itI3/sC6OIahgaTpbewcEUhVXUYcTylvbJIC+swmbeCyRtVYIl r4Qrh7id3IcoNkAC35Ec5832n5j6pfcSooFSjk2WvXfVsgJ8gDPhSrPhx5Fi/liN+vRI3P1xJ e87fViy6o9CuEoNHHB/MieXHabngDc0/mCUK4mZdg82bCP4p+7i9yDzB/WfV1pw9xUBWvK3EQ 72KrvJ6gGNi/VzyMed501pVqHp25V3yZxuiwWNWJRuTFXtPPj8GnJi6W3MNRH7cdGbf2is1Gm F1OtvQb05gK9APlXLIdU4Wwh3jlNX6FFqbx5Uvvl3jVJWrtZKwyLcSDtir1kbkotWpR9jb376 enmoFirx49OqSzocQJk8fiZ6t9dWLDuyDwMeTbE0Iq9fNP0k2sI17x4cCtGVT955GalXSQHfS ozqSH0iKPHYFJAtEE+h2VEci1OUubglmbz0g3+H9hHH5q3DHvaVrXfU4QvvyEjsOFz8NUkGWj SyDUHugIfCorpS84cEGo+uwzXvD5Pc4vSzLUR1dSQvmir2YvoKEweaoRXPS6NtzgAkCnHItxR JRMDN39MbpoCOJ9uBM2c9RMapSHdgQx3gR+0PDW0f6DGQKIz81MNnzpPhLcrNOUl48be0BsSr pHLaQ63jVMrQaYC8IseMLn+svMkGgpDgV5ScrfGgKK1nWop8+nvdEMU9gnGv5P Subject: Re: Error warning change idea From: cmbecker69@gmx.de ("Christoph M. Becker") On 29.11.2018 at 12:24, Dan Ackroyd wrote: > On Thu, 29 Nov 2018 at 09:59, MichaƂ Brzuchalski wrote: >> >> I don't really know if it fits here but some weeks ago I was thinking about >> annotations with "@" prefix >> .... >> >> Which might work as supress all errors except fatal errors. >> >> Does that sound like a solution at all? >> The developer then has full controll on what errors are suppressed or not.. > > I was thinking along similar lines a while ago: > https://gist.github.com/Danack/5ae0b1b1ce30a0d785dd > > The reason I never formally suggested it as an RFC is that I think > it's doubling down on the wrong solution. > > The vast majority of places where errors/warning are used currently, > could either be just removed or have the result of the function be > changed to be a tuple of the current result, and an error > flag/message. > > [$result, $error] = foo($bar); > if ($error !== null) { > // something went wrong. > } > // $result is usable If a function issues a warning and returns some value indicating failure, we should consider to let the function throw an exception instead. Typical cases would be getimagesize(), fopen() and password_hash(), for instance. -- Christoph M. Becker