ID: 20467
User updated by: freddy77@angelfire.com
Reported By: freddy77@angelfire.com
-Status: Closed
+Status: Bogus
Bug Type: Sybase (dblib) related
Operating System: Linux
PHP Version: 4.2.3
New Comment:
dbconvert is called passing res_length as source length. This can cause
problems...
Row
dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset),
res_length,SYBCHAR,res_buf,res_length);
should be replaced with
dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset),
src_length,SYBCHAR,res_buf,res_length);
freddy77
Previous Comments:
------------------------------------------------------------------------
[2002-12-10 09:44:50] sesser@php.net
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2002-12-09 04:11:36] freddy77@angelfire.com
You have also to decide what result you want for binary data.
If you use dbconvert for this type your results will be a hexadecimal
string. If you want binary data instead you should manually copy data
(use just memcpy) or do a conversion to binary, not to characters.
freddy77
------------------------------------------------------------------------
[2002-12-07 01:29:42] iliaa@php.net
Someone familiar with the workings of the sybase extension should
definately review the patch and make the necessary corrections before
the next RC is out.
------------------------------------------------------------------------
[2002-11-18 13:25:50] freddy77@angelfire.com
I found also another problem.
If NULL is returned (length == 0) the loop
"while (*p == ' ') --p;"
can lead to a buffer underflow,
"while (p >= res_buf && *p == ' ') --p;"
fix the problem
freddy77
------------------------------------------------------------------------
[2002-11-17 13:34:54] freddy77@angelfire.com
I forgot. To check the issue try:
#!/home/freddy/install/bin/php -q
<?php
$db_handle = sybase_connect("server","user","pass");
sybase_select_db("tempdb", $db_handle);
$db_result = sybase_query("select convert(varbinary,space(120))");
$res = sybase_fetch_row($db_result);
print "\nres=$res[0]\n";
print sybase_num_rows($db_result);
$db_result = sybase_query("select convert(numeric(18,2),1234.89)");
$res = sybase_fetch_row($db_result);
print "\nres=$res[0]\n";
print sybase_num_rows($db_result);
?>
freddy77
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20467
--
Edit this bug report at http://bugs.php.net/?id=20467&edit=1