|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45021 PDO_OCI only fetches 512 bytes from a LONG column
Submitted: 2008-05-16 14:43 UTC Modified: 2014-01-01 12:52 UTC
Avg. Score:4.6 ± 0.8
Reproduced:18 of 19 (94.7%)
Same Version:7 (38.9%)
Same OS:5 (27.8%)
From: steil at zweitwerk dot com Assigned:
Status: Open Package: PDO OCI
PHP Version: 5.2CVS-2009-04-29 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: steil at zweitwerk dot com
New email:
PHP Version: OS:


 [2008-05-16 14:43 UTC] steil at zweitwerk dot com
If you fetch from an Oracle column of datatype long, and the actual data is more than 512 byte long it will be truncated and the following warning will be issued
"Warning: PDOStatement::fetch(): column 0 data was too large for buffer and was truncated to fit it in"

Reproduce code:
$db = new PDO('oci:dbname=...', 'user', 'pwd');
$res = $db->query("SELECT longcolumn FROM table WHERE length(longcolumn) > 512");
$row = $res->fetch();
print_r('data length: '. strlen($row[0]));

results in $row[0] being truncated and the output
data length: 512

Expected result:
$row[0] should contain all of the data and the output
data length: x   (where x > 512)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-19 16:30 UTC] steil at zweitwerk dot com
Sorry, I thought I could straighten the example by omitting records with small content, but the long column does not support the length property whence the statement should just read

$res = $db->query("SELECT longcolumn FROM table");

However, the bug remains.
 [2009-04-25 15:07 UTC]
Please try using this CVS snapshot:
For Windows:

 [2009-04-29 14:13 UTC] steil at zweitwerk dot com
Testing on Linux, I can find no improvement. The error message and result are as before
 [2010-12-28 12:29 UTC] tomasz at trejderowski dot pl
Exactly the same results on PHP Version 5.3.1 and Windows XP SP 3. Conclusion: No fix up until 5.3.1.
 [2012-10-26 05:54 UTC]
-Assigned To: sixd +Assigned To:
 [2014-01-01 12:52 UTC]
-Package: PDO related +Package: PDO OCI
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 02:01:24 2020 UTC