Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113307 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 57608 invoked from network); 27 Feb 2021 16:54:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Feb 2021 16:54:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C27141804E4 for ; Sat, 27 Feb 2021 08:44:24 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 08:44:24 -0800 (PST) Received: by mail-wr1-f53.google.com with SMTP id d11so11595967wrj.7 for ; Sat, 27 Feb 2021 08:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=3tcR0t0Mxe0pi7tZcCh8RowUg6OZ115F1BM8R+AMZdI=; b=WWoFnTJCJYEJkcCVZ1iq4+KWTv+aPXvjpoec4RkDw671Gy9OWX0An5znueFDQw4X4T ggNiLpMCNEt0H9/KOnzRN7Zles8gVRBdRclizdbD0R89DUI5DEFXY2Nj5PMbTtx9e5ud w8QvfGqDiqnPd1sQk3baHSdaZLxt5r1aHPe4KdR36L82HFJwSzsHYBchlHCHGytTTbWL dzS47ANHxGVyUPoY95QvjW6LDZRUWcmIfOzYGHLsZXdN5RYPC5l6c96htuHdIltZq+kr 30ukEvz72OzAUV3juCcLdPLG5/ODBQhPxBzO7kh9SVbk8iahR29stfSkNvkbJ2UvGUV2 A3mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=3tcR0t0Mxe0pi7tZcCh8RowUg6OZ115F1BM8R+AMZdI=; b=PlQ+vdbjK35pk5OpG/1F8jiAJDLEkYILG1X2LM7xJBgGTPuiqjoLY41d+3vbHroAIt Qq5gd04K2geRXBb13aoa2lSTmgQfcVuRXSJH/gr9T9tfxRksRqSGoVbC8jRv3Ivn3rD+ FOcfOzQpi3vBMoaAXW7lQwW9zD1Yk3FiImzMVa4o3RkH5hiFv+Uil+Em2VFJ5IxJBhqQ /XC0XBWUgaBQopPi8Fr7BM7zTff7EWGHQyMvUDXpF3Xm3USEtlqCPf0ulMeHCzkW3BK8 ikbXHq0W59lBS/ChuCuG62zMz0pQbVdQnvuXGBzM7bj8fpMreUrbvQYv15VBMfVkhwVx TFEw== X-Gm-Message-State: AOAM5302+WC7PoGe/f4BoqDJFihBaDQ8LmsYjwZdnWD74ea3pFCeEpkw fiMrC60hNTepPrInq4rhF1xMGmjuixI= X-Google-Smtp-Source: ABdhPJySNZO0og42SUh6DVYsq1YW1eWdF/9ZYZGwWH5BKoOjYpM7R4nvkKtYhT/NeN2Er5d8klxm1Q== X-Received: by 2002:a5d:4523:: with SMTP id j3mr8892372wra.288.1614444259303; Sat, 27 Feb 2021 08:44:19 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id j12sm4003009wrt.27.2021.02.27.08.44.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 27 Feb 2021 08:44:18 -0800 (PST) To: internals@lists.php.net References: <84a86f15-313e-1fb3-eb09-7fd6bbdeb5ce@php.net> <821813eb972cd5dad30a0e10385a115a9a8908a2.camel@schlueters.de> Message-ID: <2d9e003c-2a05-9cfa-8625-5aedf5b069f6@gmail.com> Date: Sat, 27 Feb 2021 16:44:16 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode From: rowan.collins@gmail.com (Rowan Tommins) On 27/02/2021 16:23, Kamil Tekiela wrote: > 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. Just addressing this argument, not the proposal itself, a function throwing an exception that previously failed silently absolutely could cause problems. Consider this code: function get_product($product_id) {     $sql = "Select * From products Where product_id = '" . $dbWrapper->escape($product_id) . "'";     return $dbWrapper->runQuery($sql); } If product_id is actually an integer column, this function is technically broken: given a non-integer input, it will produce an error in the database. However, with lax error handling, the calling code will simply treat this as the product not existing, and handle it gracefully. If $dbWrapper->runQuery suddenly starts throwing exceptions, functions that were inadvertently relying on this behaviour will start failing, possibly with an uncaught exception propagating to the user. The exception is certainly pointing out a real bug, and the function can easily be fixed once the problem is spotted, but the change has a real negative impact on the application. To be clear, I am not saying I agree or disagree with this particular proposal. I note that the user could in this example update their DB wrapper to set the error mode explicitly, or to catch exceptions. I just wanted to show that "it only happens on error" doesn't mean the impact is zero. Regards, -- Rowan Tommins [IMSoP]