Edit report at https://bugs.php.net/bug.php?id=44341&edit=1

 ID:                 44341
 Comment by:         bulgur_wheat at hushmail dot com
 Reported by:        cortexd at wanadoo dot fr
 Summary:            PDOStatement::fetch() always returning string values
 Status:             Not a bug
 Type:               Bug
 Package:            PDO related
 Operating System:   Windows XP
 PHP Version:        5.2CVS-2008-03-05 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

Had to register a new email address just to comment on this. For the past 8 
years, I've spent every day of my life coding in PHP. 

The manner in which this bug was dismissed is absolutely outrageous. Fix it.


Previous Comments:
------------------------------------------------------------------------
[2011-09-19 10:27:04] aphax91 at gmail dot com

"Thank you for taking the time to write to us, but this is not
a bug."

So you mean that when the value of a mySql int field is naturally returned as a 
string, this is not considered like a bug, is that a joke ? :)

Also, if you force the conversion of integers into strings, why the PDO driver 
PDO::ATTR_STRINGIFY_FETCHES isn't supported to let us the choice ? I don't 
understand the logic behind this...

Is it planned to fix this ?

Thanks.

------------------------------------------------------------------------
[2011-04-17 10:36:58] php_nospam at ramihyn dot sytes dot net

Looking at the source of pdo_mysql shows, that pdo_mysql_stmt_get_col() returns 
a ZVAL reference instead of copying a string, if mysqlnd is in use. So why do 
the builds available for download still all have that bug?

------------------------------------------------------------------------
[2011-04-17 10:16:10] php_nospam at ramihyn dot sytes dot net

[quote]
This only matters if the underlying driver tries to return native types.
MySQL driver always returns strings.
[/quote]

3 years later: its still bugged in PHP 5.3.6. Shouldnt that be fixed by 
compiling with mysqlnd?

------------------------------------------------------------------------
[2008-03-09 17:26:40] il...@php.net

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.

------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=44341&edit=1

Reply via email to