ID: 41621 User updated by: php at mike2k dot com Reported By: php at mike2k dot com Status: Open Bug Type: Scripting Engine problem -Operating System: Ubuntu Edgy and CentOS Linux 2.6 +Operating System: Ubuntu Edgy & CentOS / Linux 2.6 PHP Version: 5.2.3 New Comment:
I understand this code doesn't actually make sense, it's not finished. But during the trial and erroring process is when I figured out it was crashing. If anything it should execute and give me the wrong results, show an error, or get caught in an infinite loop. Actually, the infinite loop piece might be it. Is there any way to trap this? Some sort of recursion limitation? Now that I am looking at the online manual, this page http://www.php.net/functions has the exact same concept. However, the expected result would be that PHP kills it, at least with a message. Previous Comments: ------------------------------------------------------------------------ [2007-06-07 09:16:51] php at mike2k dot com Description: ------------ The simple code below somehow magically triggers a segfault. PHP is compiled with './configure' '--enable-fastcgi' '--enable-discard-path' '--enable-force-cgi-redirect' '--enable-cli' '--with-mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-curl' '--enable-mbstring' '--with-zlib' '--with-gd' '--enable -track-vars' '--enable-inline-optimization' '--disable-rpath' '--disable-ipv6' '--disable-debug' '--with-jpeg-dir=/usr' '-- with-png-dir=/usr' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-shmop' '--with-xsl' '--enable-sockets' '--enabl e-pcntl' '--with-mcrypt' '--with-bz2' '--enable-sqlite-utf8' '--with-tidy' '--with-pcre-dir' '--enable-exif' NO bytecode caches or optimizers currently running either. Reproduce code: --------------- <? $uri = ereg_replace('^/bootstrap.php', '', $_SERVER['PATH_INFO']).'/'; function uri_check($uri, $level) { global $config; $uri = substr($uri, 0, strrpos($uri, '/')); if(file_exists($config['base_dir'].$uri.'.php') || file_exists($config['base_dir'].$uri.'/index.php')) { } uri_check($uri, $level+1); } uri_check($uri, 1); ?> Expected result: ---------------- Webserver returns a bad gateway 502 error. This shows up in dmesg/system logs, one per request: php-cgi[10541]: segfault at 0000007fbf3ffd48 rip 00000000006d7055 rsp 0000007fbf3ffd50 error 6 php-cgi[10546]: segfault at 0000007fbf3ffd48 rip 00000000006d7055 rsp 0000007fbf3ffd50 error 6 php-cgi[10548]: segfault at 0000007fbf3ffd48 rip 00000000006d7055 rsp 0000007fbf3ffd50 error 6 php-cgi[10535]: segfault at 0000007fbf3ffd48 rip 00000000006d7055 rsp 0000007fbf3ffd50 error 6 php-cgi[10596]: segfault at 0000007fbf3fff98 rip 00000000006d7055 rsp 0000007fbf3fffa0 error 6 Actual result: -------------- it's a pretty simple recursive function. no classes, nothing. putting that code by itself in a file without any other code (includes, anything) consistently crashes. hopefully it does for someone else who is more skilled with the debugging process. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41621&edit=1
