php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5390 PHP dumps core accessing data from sybase_fetch_row
Submitted: 2000-07-05 23:54 UTC Modified: 2000-07-30 15:48 UTC
From: bkline at rksystems dot com Assigned:
Status: Closed Package: Sybase (dblib) related
PHP Version: 4.0.1pl2 OS: RedHat 6.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bkline at rksystems dot com
New email:
PHP Version: OS:

 

 [2000-07-05 23:54 UTC] bkline at rksystems dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-27 22:14 UTC] waldschrott@php.net
Please verify that it?s still happening using the latest version from CVS or snaps.php.net.
 [2000-07-30 15:28 UTC] bkline at rksystems dot com
Fixed now (checked against php4-200007300545 snapshot).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 18:01:28 2024 UTC