From: ryan at wonko dot com Operating system: FreeBSD 4.7-RELEASE PHP version: 4.3.4RC2 PHP Bug Type: Filesystem function related Bug description: segfault when glob() is called with GLOB_BRACE and there are no matches
Description: ------------ When you call glob() with the GLOB_BRACE flag set, PHP segfaults if there are no files or directories matching the pattern. I'm running Apache 2.0.47 and PHP was built with the following configure line: './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all' '--with-regex=php' '--disable-cli' '--with-bz2=/usr' '--enable-ctype' '--with-dom=/usr/local' '--enable-exif' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-xpm-dir=/usr/local' '--with-gettext=/usr/local' '--with-mysql=/usr/local' '--with-openssl-dir=/usr/local' '--with-openssl=/usr/local' '--enable-overload' '--with-pcre-regex=yes' '--enable-posix' '--with-pspell=/usr/local' '--enable-session' '--enable-sockets' '--enable-tokenizer' '--with-expat-dir=/usr/local' '--enable-xml' '--with-zip=/usr/local' '--with-zlib=yes' '--with-apxs2=/usr/local/sbin/apxs' '--with-imap=/usr/local' '--with-imap-ssl=/usr/local' '--prefix=/usr/local' 'i386-portbld-freebsd4.7' Reproduce code: --------------- <? glob("{*.foo,*.bar}", GLOB_BRACE); ?> Expected result: ---------------- glob() should return FALSE, indicating that there were no files or directories matching the pattern. Actual result: -------------- PHP exits on signal 11 (segmentation fault), as illustrated by these entries in my Apache error log: [Tue Oct 28 22:38:02 2003] [notice] child pid 68645 exit signal Segmentation fault (11) [Tue Oct 28 22:38:03 2003] [notice] child pid 68670 exit signal Segmentation fault (11) [Tue Oct 28 22:38:12 2003] [notice] child pid 68800 exit signal Segmentation fault (11) -- Edit bug report at http://bugs.php.net/?id=26025&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26025&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26025&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26025&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26025&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26025&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26025&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26025&r=support Expected behavior: http://bugs.php.net/fix.php?id=26025&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26025&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26025&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26025&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26025&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26025&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26025&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26025&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26025&r=float