Bug #54551 [NEW]: pdo_mysql_stmt_get_col() converts DB integer to string
| From: | php_nospam at ramihyn dot sytes dot net | Date: | Sun, 17 Apr 2011 17:22:21 +0000 |
| Subject: | Bug #54551 [NEW]: pdo_mysql_stmt_get_col() converts DB integer to string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160232@lists.php.net to get a copy of this message | ||
From:
Operating system: Any
PHP version: Irrelevant
Package: MySQL related
Bug Type: Bug
Bug description:pdo_mysql_stmt_get_col() converts DB integer to string
Description:
------------
pdo_mysql_stmt_get_col() returns a string instead of an integer obtained
from the database. This happens with the pdo_mysql extension included in
the PHP download section as well as on my Ubuntu box.
Looking at mysql_statement.c from the pdo_mysql source shows, that it
returns a ZVAL reference instead of a string when compiled with mysqlnd, so
if i may ask: why isnt it the default to compile with mysqlnd?
Test script:
---------------
<?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 bug report at http://bugs.php.net/bug.php?id=54551&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54551&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54551&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54551&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54551&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54551&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54551&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54551&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54551&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54551&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54551&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54551&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54551&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54551&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54551&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54551&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54551&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54551&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54551&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54551&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54551&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54551&r=mysqlcfg