-
Couldn't load subscription status.
- Fork 8k
Open
Description
Description
The following code:
<?php
$pdo = new PDO(
'pgsql:host=localhost;port=5432;dbname=test',
'postgres',
'postgres',
[
PDO::ATTR_EMULATE_PREPARES => true,
],
);
/** @var PDOStatement $stmt */
$stmt = $pdo->prepare('SELECT :bool_val as bv');
$stmt->bindValue(':bool_val', null, PDO::PARAM_BOOL);
$stmt->execute();
foreach ($stmt->getIterator() as $item) {
var_dump($item['bv']);
}Resulted in this output:
string(1) "f"
But I expected this output instead:
NULL
When ATTR_EMULATE_PREPARES not used, NULL is actually returned.
PHP Version
PHP 8.2.11
Operating System
Alpine Linux 3.18