#44341 [Opn->Bgs]: PDOStatement::fetch() always returning string values
ID: 44341
Updated by: iliaa@php.net
Reported By: cortexd at wanadoo dot fr
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: Windows XP
PHP Version: 5.2CVS-2008-03-05 (snap)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This only matters if the underlying driver tries to return native
types.
MySQL driver always returns strings.
Previous Comments:
------------------------------------------------------------------------
[2008-03-05 18:47:25] cortexd at wanadoo dot fr
Description:
------------
PDOStatement::fetch() always returning string values, whatever the
PDO::ATTR_STRINGIFY_FETCHES attribute value
HTTP Server : Apache/2.2.6 (Win32)
MySQL Server : 5.0.45-community-nt
Reproduce code:
---------------
<?php
$mysql = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$mysql->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
var_dump($mysql->query('SELECT 42')->fetch(PDO::FETCH_NUM));
?>
Expected result:
----------------
array(1) {
[0]=>
int(42)
}
Actual result:
--------------
array(1) {
[0]=>
string(2) "42"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44341&edit=1
Thread (9 messages)