PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #1495

getAll() causes segmentation fault with sybase connection

Details

Submitted2004-05-25 16:52 UTC
Fromrandys at barnes-homes dot com
Assigneddanielc
StatusBogus
PackageDB
PHP Version4.3.6
OSLinux
Roadmaps(Not assigned)

Comments

[2004-05-25 16:52 UTC] randys at barnes-homes dot com

Description:
------------
Hi,

I am running Slackware 9.1, Apache/1.3.28, PHP 4.3.6 configured with:

'./configure' '--with-apxs=/usr/sbin/apxs' '--enable-force-cgi-redirect' '--enable-fastcgi' '--with-ncurses' '--prefix=/usr' '--enable-discard-path' '--with-config-file-path=/etc/apache' '--enable-safe-mode' '--with-openssl' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2' '--with-pic' '--enable-calendar' '--enable-ctype' '--with-curl=shared' '--enable-dba=shared' '--with-gdbm' '--with-db3' '--with-inifile' '--with-flatfile' '--enable-dio' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png' '--with-gettext=shared,/usr' '--with-gmp=shared' '--with-mbstring' '--with-mime-magic' '--with-mysql=shared,/usr' '--without-mysqli' '--with-pspell=shared,/usr' '--enable-shmop' '--enable-soap' '--enable-sockets' '--with-regex=php' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-xml' '--with-xml=shared,/usr' '--with-xsl=/usr' '--enable-yp' '--with-pear' '--enable-inline-optimization' '--enable-memory-limit' '--enable-zend-multibyte' '--with-tsrm-pthreads' '--enable-shared' '--disable-static' '--disable-debug' '--with-sybase-ct=/usr/local/freetds'

Notice that I am using the FreeTDS package to interface with my sybase server. I can connect with the standard php syntax but I get errors sometimes when using the PEAR::DB package. The following scripts are simple test scripts to demonstrate my problem

Native PHP functions (works fine):
<?php
$dbh = sybase_connect( 'htfr', 'dbo', '********' );
$sql = "SELECT user_id ";
$sql .= "FROM dbo.pc_user_def ";
$q = sybase_query($sql);
var_dump(sybase_fetch_array($q));
sybase_close($dbh);
?>

PEAR::DB connection and query (also works fine):
<?php
require_once( 'DB.php');
$dbhl = DB::connect('sybase://dbo:********@htfr/htfr' );
$sql = "SELECT user_id ";
$sql .= "FROM dbo.pc_user_def ";
$q = $dbhl->query($sql);
print_r( $q->fetchrow() );
$dbhl->disconnect();
?>

Sorry I can't give you a gdb backtrace, but the segmentation fault doesn't happen from the command line. If I am missing something, I will be more than happy to give you more information.

Reproduce code:
---------------
<?php
require_once( 'DB.php');
$dbhl = DB::connect('sybase://dbo:************@htfr/htfr' );
$sql = "SELECT user_id ";
$sql .= "FROM dbo.pc_user_def ";
$q = $dbhl->getAll($sql);
print_r( $q );
$dbhl->disconnect();
?>

Expected result:
----------------
Array
(
[0] => Array
(
[0] => Lyndsey
)

[1] => Array
(
[0] => Jennifer
)

[2] => Array
(
[0] => pcadmin
)

[3] => Array
(
[0] => Cindy
)
)

Actual result:
--------------
It depends on how I call the script. If I call it from the command line, I get this:

rsyring@gateway:~/public_html$ php -c /etc/apache/php.ini test.php
sybase_connect, htfr, dbo, sql<br />
Notice: Undefined property: num_rows in /usr/lib/php/DB/sybase.php on line 378
Array
(
[0] => Array
(
[0] => Lyndsey
)

[1] => Array
(
[0] => Jennifer
)

[2] => Array
(
[0] => pcadmin
)

[3] => Array
(
[0] => Cindy
)
)

If I call it from a browser I get nothing because it is causing a segmentation fault (as shown in /var/log/apache/error_log):

[Mon May 24 15:51:10 2004] [notice] child pid 9275 exit signal Segmentation fault (11)

[2004-05-25 16:55 UTC] randys at barnes-homes dot com

Sorry, forgot pear versions:

root@gateway:/usr/libexec# pear list
Installed packages:
===================
Package Version State
DB 1.6.2 stable
PEAR 1.3.1 stable

[2004-05-25 16:56 UTC] randys at barnes-homes dot com

changed email