Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114040 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20798 invoked from network); 12 Apr 2021 15:52:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Apr 2021 15:52:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 48F751804F8 for ; Mon, 12 Apr 2021 08:52:48 -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_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-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.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 ; Mon, 12 Apr 2021 08:52:47 -0700 (PDT) Received: by mail-ot1-f48.google.com with SMTP id w21-20020a9d63950000b02901ce7b8c45b4so13223965otk.5 for ; Mon, 12 Apr 2021 08:52:47 -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=X1gIpKzJ2sWY2jIOMcjJIcZiiZpD7t+z3acCv0K4m1Y=; b=tNVzbzu9zjx5Cn9RCxsHu0Y409ZJlqK59IkNDZhTDO/kohVykDmtux0LI6EzKqOIM7 xCldWGcvPAiS4eNedWy+KC2axbqdRjc8/SwiYFJr09MEpf1FYOlgT486Lpv36ryJI6Ri IFz+x1vfAJturk0caDA3QxiG+4y3GYryPz/LY3QS+QjAe0ykZrrQsWy4ZggVcLDXaU/L Ysp/9GiCBo8zhB2etD1vBlokPaxzp7vcFxtfXf7U8j497m5LfLkOekohnv33WMvdAE5Q GltuXhSoBbfBaRQ8Vgcxs2CefiP+f1quVqpkiBg8foARaWsqOzOOM7iueu3BWvhAFY9L aE0Q== 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=X1gIpKzJ2sWY2jIOMcjJIcZiiZpD7t+z3acCv0K4m1Y=; b=P7ZIt0hFdRpGK8KnXR/MlyQSPB+vjh3CqDKY6kFZvvN8vpgSVb+MGNlZrC7C43r+eF /JbLk1azvkvf60EEtYG4Yd1W6P+5q4L2uqQTcX3soQd6Fiz2UuEPfKH0UG88nhmGMSSB sP7G+aKsihJ5/lDA6SLBXxf9EA+weM048g9sFZnpSFOWu2tpXcrnYZHmI8IfNu5eTSFx 05WEyftZvNPAptsXMMA98irHKg9r3Ckz81s4eRt4mLdJlSLGRgerYU3D/2zvijFDenIR QAK8feWN68hOSgQhpCSkPLVJUbTsc6ha5xLK5zDNaBGu+TzFNcVzouvYS0Wx6xKNSKMK G6iw== X-Gm-Message-State: AOAM5305bjvMvp7Qq0g43nWzdxda02FxONcAmwtHmNhMilrhU/uLjqwk 9NCZtTohbzaSSNPOrYHqnrj3+qbx2a44P35tRkc= X-Google-Smtp-Source: ABdhPJwqvztycF6Pa06+DAaKTvbxPjYQ1pkpB5wbK5v90bHwPeRHT8xjKvAmtueJKDbc8tiLsU64rviZImJy0uzgvfc= X-Received: by 2002:a05:6830:1204:: with SMTP id r4mr7236349otp.358.1618242764504; Mon, 12 Apr 2021 08:52:44 -0700 (PDT) MIME-Version: 1.0 References: <1ffb0fbf-43f9-274a-37e0-8b650c02042b@gmail.com> In-Reply-To: <1ffb0fbf-43f9-274a-37e0-8b650c02042b@gmail.com> Date: Mon, 12 Apr 2021 17:52:32 +0200 Message-ID: To: Dik Takken Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000002384fb05bfc8814a" Subject: Re: [PHP-DEV] Allow commit() without transaction? From: benjamin.morel@gmail.com (Benjamin Morel) --0000000000002384fb05bfc8814a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > > I think it is really nice that commit() throws for inactive > transactions. Code paths that mess up your transactions will not go > unnoticed that easily. > +1. I've always found this behaviour in MySQL very surprising and error prone (BEGIN; BEGIN; COMMIT; COMMIT; =3D> no errors), and I'm actually very happy to see this solved at PDO level. IMO if someone relies on commit() not throwing if there is no active transaction, they should be the one doing the extra check: if ($pdo->inTransaction()) $pdo->commit(). =E2=80=94 Benjamin --0000000000002384fb05bfc8814a--