php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26659 two includes & persist-odbc & STDIN fault
Submitted: 2003-12-17 22:55 UTC Modified: 2004-01-01 20:48 UTC
From: keith at ksmith dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4.3.4 OS: Slackware 8.1 / Others
Private report: No CVE-ID: None
 [2003-12-17 22:55 UTC] keith at ksmith dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-17 22:57 UTC] keith at ksmith dot com
chaning to odbc_connect or removing first include_once eliminates the problem
 [2004-01-01 20:48 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC