PHP 4.0 Bug #5390: PHP dumps core accessing data from sybase_fetch_row
| From: | bkline at rksystems dot com | Date: | Wed, 05 Jul 2000 21:54:35 +0000 |
| Subject: | PHP 4.0 Bug #5390: PHP dumps core accessing data from sybase_fetch_row | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23506@lists.php.net to get a copy of this message | ||
From: bkline@rksystems.com
Operating system: RedHat 6.2
PHP version: 4.0.1pl2
PHP Bug Type: Sybase (dblib) related
Bug description: PHP dumps core accessing data from sybase_fetch_row
This is reproducable behavior using both the Sybase-supplied dblib and the freetds dblib.
<?php
if (sybase_connect("dbid", "uid", "pwd")) {
sybase_select_db("mydb");
$sql="select * from t";
$res=sybase_query($sql);
$ncols = sybase_num_fields($res);
while ($row = sybase_fetch_row($res)) {
$sep = "";
for ($i = 0; $i < $ncols; ++$i) {
$val = $row[$i]; # php doesn't like this line...
echo "$sep$val";
$sep = "\t";
}
echo "\n";
}
}
?>
After successfully printing the first couple of rows of data, php dumps core. The same code,
modified to run against a mysql database, works fine.
Oddly, if the line which assigns $row[$i] to $val is eliminated, and the echo is modified to
echo "$sep$row[$i]";
then the core dump is avoided.
I assume the dbdlib versions are irrelevant (I know you hate to hear things like that) since it
makes no difference whether I build PHP with Sybase's libraries or the libraries from the
freeTDS project, but just in case:
Sybase 11.9.2
freeTDS latest CVS snapshot 2000-07-04
OS:
Linux machine-name 2.2.14-5.0 #1 Tue Mar 7 20:53:41 EST 2000 i586 unknown
PHP 4.0.1 PL 2 downloaded and built fresh today (2000-07-04).
$ gdb
which php core
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `php t2.php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libgdbm.so.2...done.
Reading symbols from /lib/libpam.so.0...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /usr/local/sybase/lib/libsybdb.so...done.
Reading symbols from /usr/lib/libttf.so.2...done.
Reading symbols from /usr/lib/libgd.so.1...done.
Reading symbols from /lib/libresolv.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_files.so.2...done.
#0 0x80b2853 in php_if_sybase_fetch_row (ht=1, return_value=0x8159a1c,
this_ptr=0x0, return_value_used=1) at sybase.c:922
922 MAKE_STD_ZVAL(field_content);
(gdb) where
#0 0x80b2853 in php_if_sybase_fetch_row (ht=1, return_value=0x8159a1c,
this_ptr=0x0, return_value_used=1) at sybase.c:922
#1 0x80e8aec in execute (op_array=0x8139c44) at ./zend_execute.c:1558
#2 0x805fb4b in php_execute_script (primary_file=0xbffff984) at main.c:1157
#3 0x805e5f9 in main (argc=2, argv=0xbffff9e4) at cgi_main.c:661
(gdb)
Holler if you need more information.
Bob Kline
mailto:bkline@rksystems.com