From caa710037e663fd78f67533b29611183090068b2 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 17 Dec 2020 12:05:37 +0100 Subject: Rewrite PDO result binding Instead of requiring the type to be determined in advance by the describer function and then requiring get_col to return a buffer of appropriate type, allow get_col to return an arbitrary zval. See UPGRADING.INTERNALS for a more detailed description of the change. This makes the result fetching simpler, more efficient and more flexible. The general possibility already existed via the special PDO_PARAM_ZVAL type, but the usage was very inconvenient and/or inefficient. Now it's possible to easily implement behavior like "return int if it fits, otherwise string" and to avoid any kind of complex management of temporary buffers. This also fixes bug #40913 (our second highest voted bug of all time, for some reason). PARAM_LOB result bindings will now consistently return a stream resource, independently of the used database driver. I've tried my best to update all PDO drivers for this change, but some of the changes may be broken, as I cannot test or even build some of these drivers (in particular PDO dblib and PDO oci). Fixes are appreciated -- a working CI setup would be even more appreciated ;) --- UPGRADING | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'UPGRADING') diff --git a/UPGRADING b/UPGRADING index 8625303aac..9b80b702a3 100644 --- a/UPGRADING +++ b/UPGRADING @@ -42,6 +42,10 @@ PHP 8.1 UPGRADE NOTES - PDO: . PDO::ATTR_STRINGIFY_FETCHES now also stringifies values of type bool to "0" or "1". Previously booleans were not stringified. + . Calling bindColumn() with PDO::PARAM_LOB (and assuming stringification is + not enabled) will now consistently bind a stream result, as documented. + Previously the result would be either a stream or a string depending on the + used database driver and the time the binding is performed. - PDO MySQL: . Integers and floats in result sets will now be returned using native PHP -- cgit v1.2.1