Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128757 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 5ED2B1A00BC for ; Wed, 1 Oct 2025 14:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1759329837; bh=tBUIB9nLlh6vArUcKBih6qbKFuyq7DboBYo6WlA4w/U=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DWeyjrAJR+MpntnPFzX/ghJ7tQO6B+SiRJc6LzJiXiu5ry1yIDKgPO12V5ZY3Hb/X /DIe8j4E/rlSkkaJux0O5k3ru1TwE/X9cCiLQ43H1AcbccrkV08Ql3RWB1+0fsQEm1 +UPXuW6MaW/Yfe7TWdYF3Q5aFdiGBLDzbceQOTce5wmHnMaoONQuuXiuLJnIMiAyuz 3n5szNEhMhDwcaaosSd6rKtQpy4mmxhvuIxMvI4adSK4d75RTvrntpAylDK80E/r+4 avDTLoBeyi8pRAkqSgORpVGFJHNDBBj9Nfqua9vggXsOSF+kD/kF9S/lOC1JLfRuum 3QDnxDvm9M6cA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 170CF180047 for ; Wed, 1 Oct 2025 14:43:56 +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.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (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 14:43:55 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id 194377A0310; Wed, 1 Oct 2025 10:45:14 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Wed, 01 Oct 2025 10:45:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=allenjb.me.uk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1759329913; x=1759416313; bh=jIg03y6RvI3xdEUlnsveNZm/ezwqYGCz cBj8JyjyGxg=; b=KiNmSzE8bfrMjTyLq4L49/VLxrWdtgXA3Fr10p7w+IF61xQM +iySfe2YHyvVAZ6VbtP2hEJHQAHHp8KkUgeJsVRo3Cv9jH9ACTsfM+3gYw3AIe+F mdqHLORNJJ7poD4YOurcjmoRNC/7GQlcY8MVdzFXcH89ziSbkYsDlzXcWwo/vG/H ZOs05Rha+YFCmOhIy4MC+XApqrAW3wkkX3XP7IKQNmzoCtmfK+aS6h1KW3JwT/tv wyvKrA2Tqb/C5Sreye9PWEntIGVQbxrx8GFfM4cvY3xiXkCN8Od/j+GzO0eRacmf YdedcgDgcGJWWwFlxr2ySITmGqx8LINZ3z8Ekg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1759329913; x= 1759416313; bh=jIg03y6RvI3xdEUlnsveNZm/ezwqYGCzcBj8JyjyGxg=; b=M qUGWTqNonKNtdDhQ7qZHtEICf1WF2cQCs2zRNbtaPfZHM/krnN1wRltLjRu8alq0 wmhkc3/aroislS3Gdz4nIrM9YBw6zv3Y7VD4SeXNwUHDwbtHWCINAxVqjP2rZ9+g I1wV4pnAVPhNDQLHw/RZOfKb4rH+MDoSlnepasUjY1HgYuH8W1N0h9GQ1t1gFSiR 6InQ6aQR6zELX1JnXOND6GkJEjHDLqoftgcN6ZpCdjDimF3wXohtxgApCBafLIHo 9OnmcNVzd99P/n5IyGu+j7nCl69sHlGN2NuLgx6wm8WDp1jBqegCXJZPee1sQ2Ot Ni0AI9aHgas3DW9ZxDS7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdekfeegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptehllhgvnhfl uecuoehphhhprdhlihhsthhssegrlhhlvghnjhgsrdhmvgdruhhkqeenucggtffrrghtth gvrhhnpedtleeihedvteeuieetvddvheelgeeffefgieeuteffteduhfdtjedvhfegfeet keenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepphhhphdrlhhishhtshesrghllhgvnhhjsgdr mhgvrdhukhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepthgvkhhivghlrgdvgeeisehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhpohhs khihsehgmhgrihhlrdgtohhmpdhrtghpthhtoheptghlrghuuggvrdhprggthhgvsehgmh grihhlrdgtohhmpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdr nhgvth X-ME-Proxy: Feedback-ID: idf69468d:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Oct 2025 10:45:12 -0400 (EDT) Message-ID: <7b1f853f-1bb0-4d84-975b-164a71e092cc@allenjb.me.uk> Date: Wed, 1 Oct 2025 15:45:12 +0100 Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [Discuss] Add PDO disconnect() and isConnected() To: Kamil Tekiela , Robert Wolf Cc: Claude Pache , PHP internals References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit From: php.lists@allenjb.me.uk (AllenJB) On 01/10/2025 14:55, Kamil Tekiela wrote: > This sounds better, but I would argue that if it's a PERSISTENT > connection, then it should be impossible for the user to close it. The > idea is that the connection should remain open after being established > and should only close when the server restarts. What scenario would > necessitate the user to close a connection that should never close? As I understand it, at least in the case of MySQL, the state of persistent connections is not managed by MySQL, but by the client (PHP). This means that it's (at least theoretically) possible for a connection to end up in an undesirable state, in which case there should be a way to close it so it's not reused. I think a disconnect method should be provided, with the proviso that there should be prominent warnings regarding state management on the documentation. I've seen developers getting into trouble after attempting to implement automatic reconnection in their code with the existing PDO capabilities, so this already happens anyway. If something is primarily a footgun, I can see that as reasoning for not providing it. But a kitchen knife is equally apt at cutting food and fingers. The latter is not a good reason to not have one in the kitchen - people can learn to use them safely with adequate instruction. --- As an aside, the manual is unclear on how much management of persistent connections PDO does. I have an open issue on this: https://github.com/php/doc-en/issues/4540 (I did have a brief look again and based on some further investigation I did based (initially) on the answer thecotne gave in the above linked issue, believe that answer may not be accurate, at least in its reasoning, and thus their conclusion is circumspect. Looking at this again is somewhere on my todo list, I think)