From: keith at ksmith dot com
Operating system: Slackware 8.1 / Others
PHP version: 4.3.4
PHP Bug Type: Reproducible crash
Bug description: two includes & persist-odbc & STDIN fault
Description:
------------
This is an example of code that will cause PHP to segfault
on exit. It will otherwise perform all functions, the *exit* causes the
segfault
The combination appears to be the use of TWO(2) include files coupled with
a *persistent* odbc connection Run this, type something for input, that is
not a file or hit ctrl-d
Below is segfault2.php:
<?php
function do_nothing() {print "I did nothing\n";}
?>
Does same thing with cgi/sapi && much lighter weight options list, this
was a recent re-compile to see if problem still in 4.3.4. Tested with
4.3.1 cli/cgi also.
Configure Command => './configure' '--prefix=/usr' '--with-cpdflib'
'--with-db2' '--with-dba' '--enable-dbase' '--with-gdbm' '--with-ndbm'
'--with-curl' '--with-freetype-dir=/usr/X11R6' '--with-gd'
'--enable-gd-imgstrttf' '--enable-gd-native-ttf'
'--with-imagick=/usr/X11R6' '--with-jpeg-dir=/usr' '--with-mcrypt'
'--with-mhash' '--with-pgsql=/opt/pgsql' '--with-png-dir=/usr'
'--with-tiff-dir=/usr' '--with-unixODBC=/opt/unixODBC'
'--with-xpm-dir=/usr/X11R6' '--enable-bcmath' '--enable-calendar'
'--enable-sysvsem' '--enable-sysvshm' '--with-zlib' '--with-bz2'
'--enable-ftp' '--disable-url-fopen-wrapper' '--with-openssl'
'--disable-short-tags' '--enable-pcntl'
Reproduce code:
---------------
<?php
include_once("./segfault2.php");
// db_webdoc.inc.php appropriate php wrappings:
// $dsn = "some_dsn";
// $dbuser = "username";
// $dbpass = "password";
$dbcfg = getcwd() . "/includes/db_webdoc.inc.php";
include_once($dbcfg);
$dbh = odbc_pconnect($dsn, $dbuser, $dbpass);
while($fbase = fgets(STDIN, 1024)) {
$fbase = trim($fbase);
clearstatcache();
if(!is_file($fbase)) {
print "No such file: $fbase\n";
break;
}
}
exit(0);
?>
Expected result:
----------------
Should exit with status 0.
Actual result:
--------------
Exits by segfaulting with status 139
--
Edit bug report at http://bugs.php.net/?id=26659&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26659&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26659&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26659&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26659&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26659&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26659&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26659&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26659&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26659&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26659&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26659&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26659&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26659&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26659&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26659&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26659&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26659&r=float