PHP 4.0 Bug #5323: Accessing the array returned by sybase_fetch_array() crashes php.
| From: | miguel222 at mindless dot com | Date: | Sat, 01 Jul 2000 23:20:14 +0000 |
| Subject: | PHP 4.0 Bug #5323: Accessing the array returned by sybase_fetch_array() crashes php. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23104@lists.php.net to get a copy of this message | ||
From: miguel222@mindless.com
Operating system: Redhat Linux 6.2
PHP version: 4.0.1pl2
PHP Bug Type: Sybase (dblib) related
Bug description: Accessing the array returned by sybase_fetch_array() crashes php.
The following code snippet is used in an abstract db class in an application I am writing:
~~~~~
$query=sybase_query("<SQL QUERY HERE>");
while($row=sybase_fetch_array($query)) {
while(list($key,$val)=each($row))
if(is_int($key)) unset($row[$key]);
$result[]=$row;
}
return $result;
~~~~~
The code is used to get rid of [via unset()] the numeric keys in the array that syabse_fetch_array()
returns. When executed, the Apache server dies from a seg fault.
gdb reports different error messages spuriously:
segfault - 0x40082501 in __kill () from /lib/libc.so.6
segfault - 0x???????? in ?????? () from /opt/sybase-11.9.2/libsybc.so
If the line containing "unset()" is removed, the crash does not occur (sometimes there is
no crash, only garbled data).
If PHP is compiled with the Sybase-CT library instead, then the code works fine (unchanged), but
this is unoptimal since then warnings are generated by selecting the database with sybase_connect()
or sybase_select_db().
Please e-mail me if there is a solution to that problem. Also, I couldn't find any
documentation on the advantages or disadvantages of DB vs CT...