php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22860 odbc_longreadlen() corruption problem
Submitted: 2003-03-24 15:01 UTC Modified: 2003-04-21 09:17 UTC
From: truth at ichaos dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 4.3.2-RC OS: SuSE 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 + 42 = ?
Subscribe to this entry?

 
 [2003-03-24 15:01 UTC] truth at ichaos dot com
When odbc.defaultlrl is set to 4096 in the php.ini file, and I call odbc_longreadlen($result, 2000000); in my script, the data returned for that $result is padded at the end with garbage (prolly from memory).

When the odbc.defaultlrl is set to 2000000 in the php.ini file, and I call odbc_longreadlen($result, 2000000); in my script, the data returned for that $result is not padded at the end with garbage, and is just fine.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-24 23:20 UTC] kalowsky@php.net
And can you provide a script sample, and sample schema for me to use in testing?
 [2003-03-24 23:52 UTC] truth at ichaos dot com
All right, this snapshot didn't work. It's hard to write a script but here is a good try:

First, a table in my IBM DB2 is created
CREATE TABLE test (
  ID INT,
  DATA CLOB(1M));

Put a string in the CLOB that is greater than 5K, and and ID = 1 or so.

All right, now the script

<?
$linkid = odbc_connect("DBNAME", "USER", "PASSWORD");
$result = odbc_exec($linkid, "SELECT data FROM test WHERE id = 1");

odbc_longreadlen($result, 2000000);
odbc_binmode($result, ODBC_BINMODE_PASSTHRU);

$result = odbc_result($this->result, 1)

echo strlen($result);
?>

This should return the length of your string. If the odbc.defaultlrl is set to 4096, the string is 2000000 chars long. If odbc.defaultlrl is set to 2000000, the string is the correct length.
 [2003-03-25 00:07 UTC] truth at ichaos dot com
Actually I tried this with a string that was 28968 chars long, and this it was actually 16388 chars long instead of 2000000. The characters beyond 4096 were corrupted.

Sorry for the exagerated numbers.
 [2003-04-08 00:30 UTC] kalowsky@php.net
Can you try doing something random like changing the CURSOR type to SQL_CURSOR_FORWARD_ONLY?

DB2 doesn't like the DYNAMIC CURSOR used by PHP for some reason, and I wonder if thats the case.  I'm unable to reproduce this behavior here locally though, so it might just be a DB2 specific problem.
 [2003-04-08 01:00 UTC] truth at ichaos dot com
How do I do that?
 [2003-04-08 07:59 UTC] kalowsky@php.net
odbc_set_option.
 [2003-04-21 09:17 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC