Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128743 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 E6EC41A00BC for ; Tue, 30 Sep 2025 14:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1759243288; bh=zlRTl/C1SXKMIJpq/Js4ClkNdAVDY3hO93DIMId8xCc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gEdQk0k27J660zO7/nFjIkYuJtRQV2wlujQvS5YOhA262SuZGFuVPd/9f0vTOjSee zdnUc7Qdth5qs9i5vX/w/wZhNyP47aQIoCCdYVWUJbZKDFJmkYzRW5l9I+GL0fe3Of iDf2cqo67hs7F2/VLGz67eBnidnwngf7JYWrsiPp2bau9hPoPwBHvtpgqiUnc6PhHN yfLzeUNw+pP4APi3U5lhxb/uRIbPhwQwj7pF/HN/1+nhiOZ0Vy9rmWytUd25Z9if1t +E4frd8PDevaclxIiVCFMlPgM/C0PCXaX0Na+kKJ2atuJVHxxI81xRf0dAVD6H98B3 a9HHacvOO0pvg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2AB3B1801D5 for ; Tue, 30 Sep 2025 14:41:24 +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_MISSING,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-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) (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 ; Tue, 30 Sep 2025 14:41:23 +0000 (UTC) Received: by mail-vk1-f174.google.com with SMTP id 71dfb90a1353d-54ccb693131so376562e0c.1 for ; Tue, 30 Sep 2025 07:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; t=1759243362; x=1759848162; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zlRTl/C1SXKMIJpq/Js4ClkNdAVDY3hO93DIMId8xCc=; b=oiZs2al+iQ71Jq28wMh0wEptP6KDn+YmvjdBteMjYOBCN3en7JTnI6jJlFAsBMU0p8 LUxdd9b9wWoyu7VqBkFC5KNpAO6Hv6sfOSl8pubsZCuDH0Nu94xp0tm3HgxGX3RLe6o/ nKWkeWsAUprHEDk7Yk0fncaL/KDyuh9SZD1KE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759243362; x=1759848162; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zlRTl/C1SXKMIJpq/Js4ClkNdAVDY3hO93DIMId8xCc=; b=vB94iIppLJ5uhRe9Up2n1n6L2UjDbu4HF7339oka2IBTx+uiyCJki95lm/+qYAXKNd gmY+czwbdOKM0eLnB0duyRg3H/bFaS96TfGlctdwFQEFMduG9/2pjTeUGlJLXT0EF8JC LgeJHEumUjhgm6Ofxju7Bh3mGgrdNOpXwOJ+YVZCvmN1NuDBYSgND9oHpj8agehQevP1 1hwRltJbWm+vJftm2wWO1K+JqBwXHAJFj55X9b/8buvkpVDgj1DlowJb/QQLYoXH3gsw gD1F4PHmZ1lw/q8mlwXr/Iszlepk8yO3CHE7H5ZbkxBe9aN3MT2ggHz+8k6wsyqsMda8 Q8sA== X-Forwarded-Encrypted: i=1; AJvYcCUBA21Qhg0/Z7CuFqfDw9F5YxWcBfhZmHZzDjcCHQIbA53xUCVD+/BeXIj7I9qg1yVBrdEGjuenylw=@lists.php.net X-Gm-Message-State: AOJu0YxY6S+ToXutpAYF01dhODqboQpYKWIn7OxEgcyVaNr2gtKGMZsE atvnU96c4qbMmVkF5tG//RHkcH5CnC8olESTUYf6XJvERHxjPssds9q/KiryuKdY/qH3Pt7YdfJ W+1csU08CRfhvSWde2OuV8JtVRZujtNuCo+9RIJR6 X-Gm-Gg: ASbGncuCwcFqIHul/vVW/K0jsatMrydgdiY0E7E6BymnAOl+Znyxhvn+bgCWxCA7ebf nHgfmtnRSkQZBR93y5SGIx1iryd4VYgOM539bPVQZgmPQY+xF+2H1rUc46Qro8Rf6ZoKi6wrw6I aqh7N0jh/WvLRArBMWOozQ8rYC4dKEV+D2x4u+3DN6fFbyI/cyqfZtpWfoYNP74DSI+Ml3NuGEX 0wreueApKq8xAAOEN2auYNiXkdpUxb/Qy+UVxZ2gQ== X-Google-Smtp-Source: AGHT+IHdr4reh4droJ44MoxwQ8gImln5sEZR7E98pVisMnjGYO0XpbavzPr5tSjnLMHRSCEZTwpEp+YEuo1NTgJaUkw= X-Received: by 2002:a05:6102:3f0e:b0:4f1:7946:ed52 with SMTP id ada2fe7eead31-5acc83fb099mr8923851137.12.1759243362028; Tue, 30 Sep 2025 07:42:42 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 30 Sep 2025 17:42:30 +0300 X-Gm-Features: AS18NWCiaFDxvTSzYHB7mgtd_8BQn95_dfzT63yBhun9OKOyls8qMeoyfjeplxU Message-ID: Subject: Re: [PHP-DEV] [Discuss] Add PDO disconnect() and isConnected() To: Kamil Tekiela Cc: Robert Wolf , PHP internals Content-Type: multipart/alternative; boundary="000000000000aadefd064005c30c" From: narf@devilix.net (Andrey Andreev) --000000000000aadefd064005c30c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Sep 30, 2025 at 4:56=E2=80=AFPM Kamil Tekiela wrote: > I find this proposal to be a backwards step in the age when we are > moving away from resources and their explicit closure. We have > disabled this in PHP 8.0 for curl_close(), imagedestroy(), > openssl_pkey_free(), shmop_close() and xml_parser_free(). Sure, > mysqli_close() still works, but the whole extension is mostly a > historical artefact and a bunch of bad design choices due to what that > extension is (quick replacement of mysql_* API). PDO was designed much > better and it deliberately avoided the foot gun that is explicit > connection closure. I really wish we would not introduce bad design > choices into the language, and because of this, I wish this proposal > were unsuccessful. > All of the foot gun examples you listed are such because that historic design pattern *required* explicit resource frees, and they are foot guns because it is easy to forget doing that. Also, mysqli_close() is the only one that handles a stateful network connection and not a local resource, which is a good reason why it still works. There are legitimate use cases where you may want to explicitly and immediately close a network connection, even if PHP would do it eventually. Cheers, Andrey. --000000000000aadefd064005c30c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
--000000000000aadefd064005c30c--