Of the important PDO drivers, this affects only PDO PgSQL, as
both MySQL and SQLite do not return native boolean types.
. The mysqlnd.fetch_copy_data ini setting has been removed. However, this
should not result in user-visible behavior changes.
+- PDO:
+ . PDO::ATTR_STRINGIFY_FETCHES now also stringifies values of type bool to
+ "0" or "1". Previously booleans were not stringified.
+
- PDO MySQL:
. Integers and floats in result sets will now be returned using native PHP
types instead of strings when using emulated prepared statements. This
if (stmt->dbh->stringify) {
switch (Z_TYPE_P(dest)) {
+ case IS_FALSE:
+ /* Return "0" rather than "", because this is what database drivers that
+ * don't have a dedicated boolean type would return. */
+ zval_ptr_dtor_nogc(dest);
+ ZVAL_INTERNED_STR(dest, ZSTR_CHAR('0'));
+ break;
+ case IS_TRUE:
case IS_LONG:
case IS_DOUBLE:
convert_to_string(dest);
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
$errors = array();
$value = true;
string(3) "ERR"
array(1) {
[0]=>
- bool(true)
+ string(1) "1"
}
array(1) {
[0]=>
- bool(true)
+ string(1) "1"
}
==OK==
--EXPECT--
array(1) {
[0]=>
- bool(false)
+ string(1) "0"
}
array(1) {
[0]=>
- bool(true)
+ string(1) "1"
}
array(1) {
[0]=>
- bool(false)
+ string(1) "0"
}
array(1) {
[0]=>
- bool(true)
+ string(1) "1"
}
==OK==
["sprogress"]=>
string(3) "100"
["bhidden"]=>
- bool(false)
+ string(1) "0"
["sdatetime"]=>
string(19) "2017.10.16 08:36:45"
}