|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30070 Segmentation fault in SPL::RecursiveDirectoryIterator
Submitted: 2004-09-12 23:53 UTC Modified: 2010-12-20 10:21 UTC
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: cb at designassembly dot de Assigned: helly (profile)
Status: Closed Package: SPL related
PHP Version: 5.0.1 OS: Linux Gentoo
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
42 + 30 = ?
Subscribe to this entry?

 [2004-09-12 23:53 UTC] cb at designassembly dot de
Linux Kernel #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:
$data = array();
$path = '.';
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $file ) { 
	if (!fnmatch('*.php', $file)) continue;
	$data[] =  (string)$file ;

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:
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 ?? ()


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-13 00:02 UTC]
Please try using this CVS snapshot:
For Windows:
 [2004-09-13 10:36 UTC] cb at designassembly dot de
I tried latest snapshot and Segmentation fault is gone.
 [2004-09-13 11:20 UTC]
closing then
 [2010-12-20 10:21 UTC]
-Package: Tidy +Package: SPL related
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 04:05:53 2022 UTC