|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34001 truncating value when optional display width value is used
Submitted: 2005-08-05 02:36 UTC Modified: 2005-09-01 03:57 UTC
From: james at safesearching dot com Assigned: iliaa
Status: Closed Package: PDO related
PHP Version: 5.1.0b3 OS: *
Private report: No CVE-ID:
 [2005-08-05 02:36 UTC] james at safesearching dot com


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-10 04:01 UTC] james at safesearching dot com
Tested php5-200508100030, and the junk character issue seems to be resolved, but values from the database are still being truncated.
 [2005-08-10 10:52 UTC]
Is the truncating supposed to happen?
 [2005-08-30 01:09 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The pdo_mysql driver does not truncate any data, if it does occur it is done by myself itself.
 [2005-08-30 23:08 UTC] james at safesearching dot com
MySQL isn't doing any truncating:

Reproduce code:

$c = new PDO(

$c->exec('CREATE TABLE IF NOT EXISTS foo (id mediumint(4), primary key (id));');
$c->exec("INSERT INTO foo VALUES (6234567);");

$stmt = $c->prepare("SELECT * FROM foo");



$c = mysql_connect('localhost', '***', '***');


$r = mysql_query("SELECT * FROM foo");

while ($a = mysql_fetch_array($r))


Actual result:
    [0] => Array
            [id] => 6234
            [0] => 6234

    [0] => 6234567
    [id] => 6234567

If MySQL was truncating the data, then the results should be the same for both APIs.
 [2005-08-31 07:28 UTC]
Ilia: 1) don't use the "quick fix" all the time when you just have some short comment to add. 2) Why PDO differs with the "normal" api? :)
 [2005-09-01 03:57 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 07:01:35 2015 UTC