Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109022 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65757 invoked from network); 14 Mar 2020 22:59:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Mar 2020 22:59:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D81541804DF for ; Sat, 14 Mar 2020 14:21:11 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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, 14 Mar 2020 14:21:11 -0700 (PDT) Received: by mail-ed1-f48.google.com with SMTP id h5so16918175edn.5 for ; Sat, 14 Mar 2020 14:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/Z7iiiOM4RocKponjBS9yb/8LSaBcyfW54bU42nbl2g=; b=TvONrwyzV4oyBe5DUINjl3SYENnAAOvMSbCfsfhG1qadECpauhPBjiYs38Hsa/MNTe PP+QDnJchOim6bgQUGREqIGZR2LaIiJN579y0MX2h4P9ktqVnRUjx/SGqzoCCxnPiQ2J IcQulxx9XGZSjemRi62GKOA6o2QySFOt4Gni2Mw90aAtr621H6cy2sjH+h0XT1EH4Ukr 7HYKWnwgrwKzetiLQPDGYr7sHe3nmHSk2w35jDlH3jfYtfZ/HEF/HAfuKR7Skeerb7r7 ulH9LctpW3kX83S+gn2DGNpoVd36gnhCsh9wf1EnmymUAX1obrhZPn1eZtsby9gIFEZh GHuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/Z7iiiOM4RocKponjBS9yb/8LSaBcyfW54bU42nbl2g=; b=jhBHz6Yb3bQOrS9D0y933yYWeKa8/5GdcXb8Xbegmh09s3m8LV9h3dX75UZqV3g7Tv gp9r2PHdtjO5vQ0IzJMKiNEEqdczdpUgqKa9hF5a1mAlWNJlJBRMk1e36ykS/U4Ng/Bd qKbrO60zEUq4+es5DbwNbVNgM4ZmySWhrkZAfqvr4nT5Zhx2U2y4yLJko8oCm1PeSV0d iasxOzJ3gtPWcsVskeYR0AvQ93awTR3olmqBc4W2uabWty9lZklYT2N4XUpvHPOQNgTI 1ChC626Sgx4kgq00tp6w7unDEE4T12gz5wSrWLFK+kPxwpKEqVW9fAF574EjFj1xRcm9 JI5g== X-Gm-Message-State: ANhLgQ1wktdL7XIf7FxMUyIKVTj0aohoqELmrVauq3GV2LUrpX3DQuRz KFrhyWaWC6fq34vbgICLMJLw91OKmQF2b16v3couZc1I8sk= X-Google-Smtp-Source: ADFU+vtjK/vmqmWzKWyWMCamuXcL5KUDzfG1Q3fWd8AkuTNd2A8icoKD3eum+9dF7m46Jmp4kHO9WTl2Qxwx3T+G2oU= X-Received: by 2002:a50:fd89:: with SMTP id o9mr20330683edt.179.1584220868646; Sat, 14 Mar 2020 14:21:08 -0700 (PDT) MIME-Version: 1.0 References: <99c00084-c212-ad23-628e-87f35e2de849@allenjb.me.uk> <782751cf-0058-4dae-9f5a-40648a79986d@www.fastmail.com> In-Reply-To: <782751cf-0058-4dae-9f5a-40648a79986d@www.fastmail.com> Date: Sat, 14 Mar 2020 22:20:56 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000001f1a5905a0d72ac6" Subject: Re: [PHP-DEV] Changing the default PDO error mode From: george.banyard@gmail.com ("G. P. B.") --0000000000001f1a5905a0d72ac6 Content-Type: text/plain; charset="UTF-8" On Sat, 14 Mar 2020 at 22:10, Larry Garfield wrote: > On Sat, Mar 14, 2020, at 10:40 AM, AllenJB wrote: > > 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 > > I see only two options: > > 1) Do nothing. > > 2) Move to Exceptions. > > I've never used PDO and not set it to Exceptions, honestly. Adding more > global error conditions to code is a terrible idea, so let's not do > warnings. If your query breaks, you really shouldn't continue because your > data is busted so your following code will fail ungracefully at best, or > corrupt data at worst. > > Changing a default like this seems a reasonably safe thing to do in a > major, as long as it's still just as easy to switch back to silent mode for > those who prefer to be explicit. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php Agreed this should be an all or nothing change. Best regards George P. Banyard --0000000000001f1a5905a0d72ac6--