From:             public at grik dot net
Operating system: Linux (RH7,RH9,Gentoo)
PHP version:      5.0.4
PHP Bug Type:     Reproducible crash
Bug description:  segmentation fault when the stream with a wrapper is not 
closed (Linux RH only)

Description:
------------
There is a problem with stream_wrapper_register() that appears on Linux
and not on the FreeBSD.
I open a stream with the registered wrapper and assing a handler to the
resource variable.
If a variable stays alive when the execution of the script reaches the
end, PHP gives the segmentation fault.
Attempt to close the resource from an object destructor does not help.

Platforms tested: 5 servers with Red Hat 7, 9 and gentoo 5.03 (kernels
2.4, 2.6, 2.6 hardened), PHP 5.03, 5.04, 4.3.7

In FreeBSD 5.3 there is no problem executing the script.

Reproduce code:
---------------
<?php
class Wrapper{
    function stream_open($path, $path, $options, &$opened_path){return
true;}
//... other methods do not matter for this bug
}

stream_wrapper_register("wr", 'Wrapper')
or die("Failed to register protocol");

$fp = fopen ('wr://example', 'w');

//fclose ($fp);
echo microtime();
?> 

Expected result:
----------------
time with microseconds

Actual result:
--------------
When run from the command line - time with microseconds and words
"Segmentation fault",
when called from browser - no output.

-- 
Edit bug report at http://bugs.php.net/?id=32742&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32742&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32742&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32742&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32742&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32742&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32742&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32742&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32742&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32742&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32742&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32742&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32742&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32742&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32742&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32742&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32742&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32742&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32742&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32742&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32742&r=mysqlcfg

Reply via email to