Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128750 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id E13361A00BC for ; Wed, 1 Oct 2025 07:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1759302598; bh=Hs4JD0DDjUhHYyvOFwU59CNDX9f+25jXYRP+hCPK0vI=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=BsrDryoj5wWPosR80uRtGxnvQ47nJ+pTIazaWifTbG/opAeFCxy7q1sG/3gNtdqvr ydr1X8SANS6ACzXyQBGJE+nW1w/rQ2BEmwO3LnlBtnODncMXQCIFyxmenNH7XFoc+b CFLiSIdb+iydiqmnKkMlC+2+Fcnb3YcMTjU3pAMcCGSf6vmTbbbB3JtJrQsKUVmaf6 +2wgoBOgikFqjpDXEXANM65CLO+lVyhLB1Ypfuewq4mvB1/iP1K9EW4/ONenXhRKRc tXoAx0h5bEOTGfytnUqNX9UgLIb58ynow0uBwrsNdg+iP7O4WAjRYfuJEmxf9K2BcP iIxpH1LpuUC+A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4D35C18006E for ; Wed, 1 Oct 2025 07:09:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 1 Oct 2025 07:09:53 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-421851bcb25so1647883f8f.2 for ; Wed, 01 Oct 2025 00:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759302672; x=1759907472; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=Oa3UNAokto4IS1k3zk18fr77c0O+PewLlLuGrRmKY94=; b=dAzNzEomnuEu8FmWyhAkrw+YkAb1MOPrpK00gSqapWTv9IXInqSZIhbDLINLbMsNEM L1ou/hM6/eH/bdfQllvtZ5K0HH4i5MAMDZsx8OpQ63g+nmLlclaq4nI4tOq4LFgfveEP cQFQ2/3THx0lByXMHcCWZR0SYZvj7t5LdcKGGxyBn1YaL16rmXXthbrDfNik/xTcH3YJ KF/WGYUAmJcPTMZvCxbll6KuT34khmj9pCZBMLxxe1Zl1ovcgHsvGUj0ocj7YRJ8NVe8 O45MtkMkHa7FvjoOASDMJ2gj8gJl5MyKoaE/fLiKEBDJM8Us9cehHcG0FgoVrDTNnmqF kbRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759302672; x=1759907472; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Oa3UNAokto4IS1k3zk18fr77c0O+PewLlLuGrRmKY94=; b=Lr4yRI1Sl3bdT4GVh5duH/ZTtb5kpI1+dUfulRgyxUPOL3LWQZckOcUYMszaQuhXfZ lJYQgq5lJoPW320VVZuuvYMw2ppLvhxISyOgSyqFtoAj3p4+tA+Y6USCKog3Ty0l1csG xJcpz4HVKogPMPJ2hKA2r6O/3IP1wx9y+dLrDQnxvMBxJhufbn3nU/vFzzVCv/K92hg3 yT9FXJZi6gEeFkUwR3RIoVPzEMgZV7eobMzrPXHuWBMY8CePuhrrHDDCs/kQoxP2tY04 QZyBmy/mTXq/Bkx+C2QA8Lr6+vkvdbCiK5OlZat8Jw2AVs6cdm0lUkMOuZnmp2DQows/ yr+w== X-Gm-Message-State: AOJu0YxZeFaRSVXX8p8oHyLTEpjJiAB5Md4MsnVERo8C6igcwtw+aEml lNcHfln1s/20EAv9LK4rU+RYIPzU3Ev5iXuaK2DbJfLPrUJPe7Ax3Vsx X-Gm-Gg: ASbGncsP0/GmyfAsEYBmuo1rrSpwvb/+Vh7w9L1JRl7noTSU/DkRZ1p5yNerJpEUS+Y 9kxM1KzxUmlr6mt5li5WbMbhfLWhISjS+8suss7CexLaNbHQgrZmK+NXa8VzvswhN7g1JHv7pxi xuWI5FWfJsyXwRXurB9/IENnW+hCUZyq8YO9djVa5UXnvSc0pCeVJc0hqncFckhFKN7YhVsp4jB bd2VrE4DMpR3WIMxWOZjoNtnEbFWvC/MBHaISE7A+GLA1RU8OnOMSWhIVcFGoxa8Gpgej5PAHXl /vjoQ8EAPA7IVjiv+MrtEXRc97t9dbqswl7+NORek8vB5U2OkCvWe10qSuG5AL1aZ9vg39HcNIx B9em/9QxmlFjL2wayKbtKoykQ0dSlb7PlApr/H/dtaCtpgzulzOGSJUVYfIdZlgtt X-Google-Smtp-Source: AGHT+IH2Y5jJ8YD0hZH+IavL/xPnYisqCJ191A02QP3Ms8hGq5o29KLUiNaZMJ0pLY2tmutnI4UNaw== X-Received: by 2002:a05:6000:186e:b0:3e9:b208:f2d2 with SMTP id ffacd0b85a97d-42557a15a22mr1735334f8f.50.1759302671388; Wed, 01 Oct 2025 00:11:11 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-40fc6cf3835sm25943225f8f.46.2025.10.01.00.11.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Oct 2025 00:11:10 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_9D3E1AC2-3625-4064-A475-C6864B89E51F" Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PHP-DEV] [Discuss] Add PDO disconnect() and isConnected() Date: Wed, 1 Oct 2025 09:11:00 +0200 In-Reply-To: Cc: PHP internals To: Robert Wolf References: X-Mailer: Apple Mail (2.3826.700.81) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_9D3E1AC2-3625-4064-A475-C6864B89E51F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 30 sept. 2025 =C3=A0 14:49, Robert Wolf a =C3=A9cr= it : >=20 > Hello all, >=20 > I am announcing discussion phase of RFC "Add PDO disconnect() and = isConnected()". As the title suggests, this proposes to add a PHP = interface to disconnect a PDO client, an alternative to the object = destructor. >=20 > Thank you in advance for your consideration and guidance. >=20 > https://wiki.php.net/rfc/pdo_disconnect >=20 > -Robert Wolf >=20 Hi,=20 I=E2=80=99ve reviewed my uses of mysqli->close() in the wrapper class = around mysqli I wrote several years ago. All of them were useless, and I = have just deleted them after having carefully checked the documentation. = Here is the most obvious case (yes, this is real code): ```php public function __destruct() { if ($this->link !=3D=3D null) { @ $this->link->close(); $this->link =3D null; } } ``` I wished that mysqli->close() were never implemented... Methods like mysqli->close() are innocuous by themselves. The issue is = that users are tempted, even incited, to do manual operations that are = very well done automatically (in this case, by the garbage collector). = They are also driven to ask themselves questions that they don=E2=80=99t = need to bother (=E2=80=9Cwhat if disconnection fails?=E2=80=9D). If you still have good reasons to add such a method in pdo. I recommend = to use a name that deters users from using it in normal operations, e.g. = pdo->debug_manual_disconnect(). =E2=80=94Claude --Apple-Mail=_9D3E1AC2-3625-4064-A475-C6864B89E51F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 30 sept. 2025 =C3=A0 14:49, Robert Wolf = <rposky@gmail.com> a =C3=A9crit :

Hello = all,

I am announcing discussion phase of RFC "Add = PDO disconnect() and isConnected()". As the title suggests, this = proposes to add a PHP interface to disconnect a PDO client, an = alternative to the object destructor.

Thank you in = advance for your consideration and guidance.


-Robert = Wolf

=

Hi, 

I=E2=80= =99ve reviewed my uses of mysqli->close() in the wrapper class around = mysqli I wrote several years ago. All of them were useless, and I have = just deleted them after having carefully checked the documentation. Here = is the most obvious case (yes, this is real = code):

```php

 = ;   public function __destruct() {
      =   if ($this->link !=3D=3D null) {
      =       @ $this->link->close();
  =           $this->link =3D = null;
        }
    = }

```

I wished = that mysqli->close() were never = implemented...

Methods like mysqli->close() = are innocuous by themselves. The issue is that users are tempted, even = incited, to do manual operations that are very well done automatically = (in this case, by the garbage collector). They are also driven to ask = themselves questions that they don=E2=80=99t need to bother (=E2=80=9Cwhat= if disconnection fails?=E2=80=9D).

If you = still have good reasons to add such a method in pdo. I recommend to use = a name that deters users from using it in normal operations, e.g. = pdo->debug_manual_disconnect().

=E2=80=94Claud= e

= --Apple-Mail=_9D3E1AC2-3625-4064-A475-C6864B89E51F--