From: dmda at yandex dot ru Operating system: ANY PHP version: 5.2.6 PHP Bug Type: Reproducible crash Bug description: crash if -z and -m are used together
Description: ------------ if -z and -m command line options are used together, php-cgi will crash. It happens b'ze print_extensions() function in cgi_main.c has a serious flaw: 1) it first makes a copy of the main list of zend_extensions 2) then it dumps out the content 3) then it destroys its copy of the list Duding phase 3, the list destructor is called and it UNLOADS all the zend_extensions. SHULD be noted that at this time the main list still has original copies of zend_extensions and that's why php will crash during shutdown in attempt to walk through the list and shutdown the extensions. You may replicate the problem with _ANY_ zend_extension. Better to do it under Windows that unmaps memory regions and shutdown will try call non-existing code. So the crash is inavoidable. Reproduce code: --------------- no code necessary Expected result: ---------------- no crash is expected Actual result: -------------- backtrace from VC6: 015c2049() zend_extension_shutdown(_zend_extension * 0x014c4568, void * * * 0x01021c70) line 129 + 10 bytes zend_llist_apply(_zend_llist * 0x10508620 _zend_extensions, void (void *, void * * *)* 0x1007536c zend_extension_shutdown(_zend_extension *, void * * *), void * * * 0x01021c70) line 193 + 14 bytes zend_shutdown_extensions(void * * * 0x01021c70) line 166 + 19 bytes zend_shutdown(void * * * 0x01021c70) line 741 + 9 bytes php_module_shutdown(void * * * 0x01021c70) line 1887 + 9 bytes main(int 4, char * * 0x01021cd0) line 2058 + 10 bytes PHP-CGI! mainCRTStartup + 227 bytes KERNEL32! 7c816fd7() -- Edit bug report at http://bugs.php.net/?id=45217&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45217&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45217&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45217&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45217&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45217&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45217&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45217&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45217&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45217&r=support Expected behavior: http://bugs.php.net/fix.php?id=45217&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45217&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45217&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45217&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45217&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45217&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45217&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45217&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45217&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45217&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45217&r=mysqlcfg