[php-src] Issue #12581: Null normalizes to 'f' when PDO::ATTR_EMULATE_PREPARES = true

From: Date: Tue, 31 Oct 2023 15:49:51 +0000
Subject: [php-src] Issue #12581: Null normalizes to 'f' when PDO::ATTR_EMULATE_PREPARES = true
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245702@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12581 Author: juffin-halli ### Description The following code: ```php <?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

« previous php.bugs (#245702) next »