Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125833 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 qa.php.net (Postfix) with ESMTPS id 69DEF1A00BD for ; Wed, 23 Oct 2024 15:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1729697951; bh=oruML5wuSjS3Nvs87rB8DUqqfWDNf1xQwID+qT+sYSM=; h=From:Subject:Date:To:From; b=fhprFOFW/682HBiRrFZL8KUDShKPzucfyGc+FTL4GXoff20k0YgA1t1Onw9Ngz30L Dejx4/MK6VwVx2CG09Zqf4nVbCRRQvOiHjiFdTc5BOdlFSQFQECdBpc2IqmXYTZg/M icy7uQTU+pe8zX0Fqo8QUflZFFH3pqZQtZ2w4U/Bxuj6aGSuqFoxArdi7exfwOk52Q PcEyXYgUczgaw4EaAJcSaEnwasaNoc/4RzYWDS4DDL6VwV9KtFFaxMwhhRgvn/2wjx vm/zvwt2DWr7u8lBNmkmhmJqi2hdeRK4GPrjJiZFyOYYjCyXEDGh8NjW1ugkScfy/y k6x12smlomMjQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6759F18007E for ; Wed, 23 Oct 2024 15:39:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from supercat.cmpct.info (supercat.cmpct.info [71.19.146.230]) (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, 23 Oct 2024 15:39:09 +0000 (UTC) Received: from smtpclient.apple (fctnnbsc38w-142-162-55-237.dhcp-dynamic.fibreop.nb.bellaliant.net [142.162.55.237]) by supercat.cmpct.info (Postfix) with ESMTPSA id 381B6545C5 for ; Wed, 23 Oct 2024 15:36:43 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: [PHP-DEV] Interest in a binary parameter type in PDO? Message-ID: <193E3B72-AE8B-4686-8ACB-9CB68E3947BC@cmpct.info> Date: Wed, 23 Oct 2024 12:36:31 -0300 To: php internals X-Mailer: Apple Mail (2.3776.700.51.11.1) From: calvin@cmpct.info (Calvin Buckley) Hi internals, I've been debugging some recent issues users have had, as well as discussing some related ones. I've come to the conclusion there's a lot issues with applications trying to access binary data via PDO drivers. For example - Binary data when quoting in SQL Server can easily get mangled, as the quoter can't handle binary data and truncates the string. It's possible other drivers are like this too. - ODBC drivers can be unpredictable behaviour wise when binding binary data as SQL_C_CHAR (like what the get_col handler does). In the case of one driver, it will hex encode the data and can confuse the size handling in the get_col handler. I've thought about overriding the LOB semantics for quick fixes, but this isn't the right solution, as a LOB and binary data are orthogonal; i.e. CLOBs are LOB strings and VARBINARY doesn't have LOB semantics. A binary type (or modifier, i.e. like intl/natl, not to bikeshed tho) can also be used w/ string columns in the database to possibly override i.e. automatic charset encoding changes from an ODBC driver. I had previously made an issue and PR (links below), but I'm discussing on internals to revitalize the conversation after being motivated by recent issues. I'd like to hear from users, database extn. developers, and userland database library extension developers if this is the right approach, and if I should move forward dusting off the PR and probably writing an RFC. Said PR includes the changes needed for DBLIB, ODBC, and SQLite driver wise, as well as some tests. MySQL/Postgres/Firebird support would need to be added. ~calvinb [issue]: https://github.com/php/php-src/issues/11462 [pr]: https://github.com/php/php-src/pull/11674