From:             cb at designassembly dot de
Operating system: Linux Gentoo
PHP version:      5.0.1
PHP Bug Type:     Class/Object related
Bug description:  Segmentation fault in SPL::RecursiveDirectoryIterator

Description:
------------
System:
Linux Kernel 2.6.8.1-mm3 #1 SMP i686 Intel(R) Pentium(R) 4 CPU 2.80GHz
GenuineIntel GNU/Linux

Run this shown code, which crashes php in php_mod or client version


Php config:
 Configure Command =>  './configure' '--prefix=/usr'
'--host=i686-pc-linux-gnu' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--datadir=/us
r/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--disable-cgi'
'--enable-cli' '--enable-embed' '--enable-debug'
'--with-config-file-path=/
etc/php/cli-php5' '--enable-bcmath' '--with-bz2' '--disable-calendar'
'--without-cpdflib' '--with-curl' '--without-curlwrappers'
'--disable-dbase'
'--disable-dio' '--enable-exif' '--without-fam' '--without-fbsql'
'--without-fdftk' '--disable-filepro' '--disable-ftp' '--with-gettext'
'--without
-gmp' '--without-hwapi' '--without-iconv' '--without-informix'
'--without-ingres' '--without-interbase' '--enable-mbstring'
'--with-mcrypt' '--with
out-mcve' '--disable-memory-limit' '--without-mhash'
'--without-mime-magic' '--without-ming' '--without-mnogosearch'
'--without-msql' '--without-ms
sql' '--with-ncurses' '--without-oci8' '--without-oracle' '--with-openssl'
'--with-openssl-dir=/usr' '--without-ovrimos' '--disable-pcntl' '--witho
ut-pcre-regx' '--without-pfpro' '--without-pgsql' '--disable-posix'
'--with-pspell' '--without-recode' '--disable-shmop' '--without-snmp'
'--enable
-soap' '--disable-sockets' '--without-sybase' '--without-sybase-ct'
'--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--with-tidy'
'--di
sable-tokenizer' '--disable-wddx' '--with-xsl' '--without-xmlrpc'
'--disable-yp' '--with-zlib' '--without-cdb' '--with-db4' '--without-dbm'
'--with
out-flatfile' '--with-gdbm' '--without-inifile' '--without-qdbm'
'--with-jpeg-dir=/usr' '--with-freetype-dir=/usr' '--with-t1lib=/usr'
'--enable-gd
-jis-conf' '--enable-gd-native-ttf' '--with-png-dir=/usr'
'--with-tiff-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-imap'
'--with-imap-ssl' '-
-with-ldap' '--with-ldap-sasl' '--with-mysql'
'--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--without-mm'
'--without-msession' '--without-sqlite
' '--enable-dba' '--with-readline' '--without-libedit'


Reproduce code:
---------------
<?php
$data = array();
$path = '.';
foreach(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($path)) as $file ) { 
        if (!fnmatch('*.php', $file)) continue;
        $data[] =  (string)$file ;
}
print_r($data);
?>

Expected result:
----------------
fnmatch should raise error: "object input not possible for second
argument" and php should exit, but this shouldn't cause a segfault. A
explicit string type cast for $file  works without a problem. 

Actual result:
--------------
backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x082a2f04 in zend_object_store_get_object ()
(gdb) bt
#0  0x082a2f04 in zend_object_store_get_object ()
#1  0x081b797d in zif_spl_RecursiveDirectoryIterator_hasChildren ()
#2  0x0861c0a4 in ?? ()
#3  0x085515a0 in ini_scanner_globals ()
#4  0x00000010 in ?? ()
#5  0x08273488 in _emalloc ()
#6  0xbfffb9b8 in ?? ()


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

Reply via email to