Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113005 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53163 invoked from network); 27 Jan 2021 15:26:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2021 15:26:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5B5AD1804DC for ; Wed, 27 Jan 2021 07:07:50 -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=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 ; Wed, 27 Jan 2021 07:07:49 -0800 (PST) Received: by mail-ej1-f52.google.com with SMTP id g3so3114198ejb.6 for ; Wed, 27 Jan 2021 07:07:49 -0800 (PST) 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=CQWnEWTdO9kGMRlLwK094XfM0abdV4DQYbwM5cizujM=; b=HvdcW5Yq2Hd+KMJaJg6ok60uCe5YzjqtAAsnixOJ+W3gP/FvHUiOdD7SOS0nWgYDXk m06GdyiYIxCOE/JfsBA4DjbalfX3LgojZN2Y/wSU4ERmCuEiFy2vi2VUgWgePTD+NBNL +v1WiBVlA7NW8HKR6cxguQtLMHKkVh9gygeggLed1UleKuIDcW02FHOckEvSRMp2/xL8 hHoPz5scMKt2d/xwYjL9F9M0WaweG3ZsfkqVRVM01mrGVjfNm+g6RpR+mVLnOT67OiyR FtTZ9y4aq83Y64vD/jue99wL+K7zPYy07PSx+n124dRKt7eLIx6g83n5nJKBo7Iv7CAH VXfw== 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=CQWnEWTdO9kGMRlLwK094XfM0abdV4DQYbwM5cizujM=; b=ZxXCvCUBWqIdRW/YuJwCPzD+06+/sJkrYGi9sU5KW9YKgJ0M8UaROlN6QJPIkjfzqd IugH42oXFoBWqbcLbO9kqHvBQ7bQBHZJ4YW+E+u6v2dBw3mEKxj96/TMh3JofwoLC0mr moHsUDmvUosFkXOL+Pr2wiRRD8u5GBxFrjO6NceV85zn+Sr4K/ZYskMcT+HhpXMswT02 4JPjFJeoJgvZtqU8GRBNoh/mhQVfmsjc9nu3q82tC/npCatNiCIypTVLm/+9/BiUuKsK r3+peTOQEii7XrDOoXABkqVrIeimp8URMbbaZ+EQ2pYKWsn/0Is8C/of6iv7Iiej3KDc OirA== X-Gm-Message-State: AOAM531ZwHttai8hmXfvlwtFRslzl/uXQQxbeGV1brilRbuS33B+4D4x VODZtgPiRCmO3JfzovTDurqF2jic+lwZCsu6KFM= X-Google-Smtp-Source: ABdhPJxyzQpFH497frmf+D937iOmz0KF0/xNg8RM4zqLJsZfMRFI84YWSSjQnfqGKjgVSvg1wxk2Q3aEsYInz+uJewk= X-Received: by 2002:a17:906:b219:: with SMTP id p25mr6832436ejz.430.1611760064119; Wed, 27 Jan 2021 07:07:44 -0800 (PST) MIME-Version: 1.0 References: <0edafce4-c9a5-c483-65f1-72e49614135a@telia.com> <4D7D042F-39A5-4BEF-93B6-542FD53928A1@cschneid.com> <73C12DD2-D99E-44BA-B557-6043F3DDD4C7@cschneid.com> <30C0E1A8-6269-4221-AF21-3FA738D5910C@cschneid.com> In-Reply-To: <30C0E1A8-6269-4221-AF21-3FA738D5910C@cschneid.com> Date: Wed, 27 Jan 2021 15:07:33 +0000 Message-ID: To: Christian Schneider Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="00000000000015c8b905b9e32287" Subject: Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode From: tekiela246@gmail.com (Kamil Tekiela) --00000000000015c8b905b9e32287 Content-Type: text/plain; charset="UTF-8" > > Wouldn't this mean everybody would add mysqli_report() to their code? That is the idea. That is what everyone should already have in their codebase. And wouldn't this render the default of mysqli_report() entirely useless? I'm sorry, but I don't follow the train of thought? Why would it make that useless? You must set the correct error reporting mode anyway and that function helps in doing so. Or is your idea that at a later stage you then want to create a warning > for manual mysqli_report() calls? What are manual mysqli_report() calls? You either have that line in your code or you don't. The idea that Nikita suggested is to meet your concerns. The only way to figure out if your code needs an adjustment is to have a warning emitted from any mysqli connect methods if you have not called mysqli_report before. It would inform users that they are missing the setting. No, I want to know if I have any code which needs fixing so I can see how > I want to change those places e.g. a duplicate key from INSERT to REPLACE > or whatever the correct fix is. Without the code aborting. You can do that right now. This proposal will not make it easier or more difficult for you to do that. Just paste mysqli_report(MYSQLI_REPORT_ERROR) before mysqli_connect() and PHP will generate a warning whenever your SQL throws an error. Otherwise the temptation is big to just add a global > mysqli_report(MYSQLI_REPORT_OFF) everywhere just in case. I don't get what's wrong with that. This is literally what I said in the RFC you can do if you don't want mysqli to report any errors. Whoever doesn't want to see errors can use this line to silence them. I would even make a counterpoint. If we set MYSQLI_REPORT_ERROR as the default then users will definitely silence errors and forget. The warning mode is so useless and annoying that people will prefer to silence it seeing no benefit to it. If we want this change to be useful then we should make SQL errors report as exceptions by default. Regarding Nikita's proposal: The compromise is reasonable, but this will not be well-received by the community. Additional warnings will only make things more confusing without providing outstanding benefits. If we want to force people to set the error reporting mode that they want, then it would be better to set a sensible default value and give a clear explanation in the migration guide how to set it back to the previous value. Of course, I don't hate Nikita's proposal and I might say I even like it a little bit, but only in connection with exception mode as the default value. This way users will not be surprised by an exception if it happens that they forget to silence. But I would prefer that everyone embraced exceptions. --00000000000015c8b905b9e32287--