From:             ttessier at swhistlesoft dot com
Operating system: solaris 10
PHP version:      5.2.10
PHP Bug Type:     Filesystem function related
Bug description:  when fopen is used without the second parameter, php 
segfaults in apache 2.2

Description:
------------
When fopen is used without the second parameter, php segfaults in apache
2.2. I had this happen two times, once when I was using bcompiler and once
when I was using xml_parser. I thought that the issue was the other modules
until I realized that I was missing the second parameter to fopen. 

I was doing a test on the returned value to check for validity such as if
( $fh ) or if ( is_resource ( $fh ) ) and was unable to see any warnings.

Once I removed the test and any interior blocks to the filehandle test
from the code, I was able to see a warning. I fixed the issue and have been
working solid since. 

Reproduce code:
---------------
$regionf = 'regions.xml' ;
$fregions = fopen ( $regionf ) ;
if ( $fregions ){
    echo "File Opened" ;
    $xmldoc = fread ( $fregions, filesize ( $regionf ) ) ;
    $parser = xml_parser_create  ( ) ;
    if ( $parser ){
        xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING, "UTF-8");
       xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1); 
       xml_parse ( $parser, $doc ) ;
       xml_parse_into_struct($parser, trim($xmldoc), $xml_values);
       print_r ( $xml_values ) ;
       xml_parser_free ( $parser ) ;
    }
    fclose ( $fregions ) ;
}

Expected result:
----------------
apache segfault -  browser displays previous content ( cache )


-- 
Edit bug report at http://bugs.php.net/?id=49338&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49338&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49338&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49338&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49338&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49338&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49338&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49338&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49338&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49338&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49338&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49338&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49338&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49338&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49338&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49338&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49338&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49338&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49338&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49338&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49338&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49338&r=mysqlcfg

Reply via email to