Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109015 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85775 invoked from network); 14 Mar 2020 17:18:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Mar 2020 17:18:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 775CF1801FD for ; Sat, 14 Mar 2020 08:40:35 -0700 (PDT) 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_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8943 85.119.80.0/21 X-Spam-Virus: No X-Envelope-From: Received: from mail.apserver.co.uk (server2.alteredperspective.co.uk [85.119.82.103]) by php-smtp4.php.net (Postfix) with ESMTP for ; Sat, 14 Mar 2020 08:40:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.apserver.co.uk (Postfix) with ESMTP id 5B2F04F4064 for ; Sat, 14 Mar 2020 15:39:41 +0000 (GMT) Received: from mail.apserver.co.uk ([127.0.0.1]) by localhost (server2.alteredperspective.co.uk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZGjM9z5wZGZA for ; Sat, 14 Mar 2020 15:39:39 +0000 (GMT) Received: from [192.168.0.6] (cpc113420-maid7-2-0-cust1808.20-1.cable.virginm.net [86.18.119.17]) by mail.apserver.co.uk (Postfix) with ESMTPA id D5C4A4F4061 for ; Sat, 14 Mar 2020 15:39:39 +0000 (GMT) To: PHP Internals Message-ID: <99c00084-c212-ad23-628e-87f35e2de849@allenjb.me.uk> Date: Sat, 14 Mar 2020 15:40:30 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Changing the default PDO error mode From: php.lists@allenjb.me.uk (AllenJB) Hi all, A regular problem that new users run into is error handling with PDO. The current default error mode for PDO is "silent". This leads to the situation where code doesn't work and returns no obvious errors unless PDO specific error handling code is explicitly added. I would like to propose the default error mode be changed from PHP 8 as I believe this would make PDO error handling much more intuitive for new developers, preventing the common "my code isn't working and I don't know why" scenario that occurs. While a BC break, I believe it's the type of change developers expect in a major version and I don't believe that explicitly setting the error mode for code bases that rely on the silent error mode is onerous - many code bases are already explicitly setting the error mode already. Given the way error handling has been / is heading in PHP, I would suggest the default error mode should be exceptions, but I can forsee arguments for using warnings instead ("less of a BC break" since code would still continue unless a custom error handler causes an abort, so closer to the behavior of "silent"). What are peoples views on making this change? What do you think the new default be (and why)? (I am aware this change will likely require an RFC) AllenJB