[php-src] Issue #15810: PDO with pgsql changed data types returned from float queries starting with PHP 8.4

From: Date: Mon, 09 Sep 2024 10:43:36 +0000
Subject: [php-src] Issue #15810: PDO with pgsql changed data types returned from float queries starting with PHP 8.4
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247727@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15810 Author: janedbal ### Description The following code: ```php <?php $pdo = new PDO('pgsql:host=pgsql;dbname=foo', 'root', 'secret'); $pdo->exec('DROP TABLE IF EXISTS test'); $pdo->exec('CREATE TABLE test (col_float FLOAT)'); $pdo->exec('INSERT INTO test VALUES (0.125)'); $result = $pdo->query('SELECT col_float FROM test')->fetchColumn(); var_dump($result); ``` Resulted in this output: ``` float(0.125) ``` But I expected this output instead: ``` string(5) "0.125" ``` ----- This behaviour **changes in PHP 8.4** (_prior this version, you always get string_) and seems to affect all float results. This was detected by [failing phpstan-doctrine tests](https://github.com/phpstan/phpstan-doctrine/actions/runs/10738558339/job/29782377678) where we infer data types returned from drivers. I didnt find **any relevant note about this behaviour change** in [UPGRADING notes](https://github.com/php/php-src/blob/d670ee7d035aa5d2c098551ce5e9e0b202294bdd/UPGRADING), so this feels unintentional. I suspect https://github.com/php/php-src/pull/14035 might be the cause. _I can provide fully dockerized repository for reproduction if needed._ ### PHP Version PHP 8.4.0beta4 ### Operating System Debian 12 (bookworm)

« previous php.bugs (#247727) next »