From: agiorgio at optonline dot net Operating system: Linux PHP version: 5.1.4 PHP Bug Type: Reproducible crash Bug description: Calling opendir() causes a SEGV
Description: ------------ When calling opendir, PHP segfaults. Reproduce code: --------------- <? class mystream { function stream_open($path, $mode, $options, &$opened_path) { return true; } function dir_opendir($url, $options) { return true; } } if(!stream_wrapper_register("test", "mystream")) { die("test wrapper registration failed"); } mkdir("test://a"); $dir = opendir("test://a"); // The SEGV happens here ?> Expected result: ---------------- PHP should not crash. Actual result: -------------- (gdb) run Starting program: /home/angio/php-5.1.4/sapi/cli/php ~/test.php Warning: mkdir(): mystream::mkdir is not implemented! in /home/angio/test.php on line 19 Program received signal SIGSEGV, Segmentation fault. 0x0824e632 in zend_object_store_get_object (zobject=0x3) at /home/angio/php-5.1.4/Zend/zend_objects_API.c:215 215 return EG(objects_store).object_buckets[handle].bucket.obj.object; (gdb) t [Current thread is 0 (process 28095)] (gdb) where #0 0x0824e632 in zend_object_store_get_object (zobject=0x3) at /home/angio/php-5.1.4/Zend/zend_objects_API.c:215 #1 0x08225030 in zend_call_function (fci=0xbfb6c270, fci_cache=0x0) at /home/angio/php-5.1.4/Zend/zend_execute_API.c:661 #2 0x0822524e in call_user_function_ex (function_table=0x3, object_pp=0x3, function_name=0x3, retval_ptr_ptr=0x3, param_count=3, params=0x3, no_separation=3, symbol_table=0x3) at /home/angio/php-5.1.4/Zend/zend_execute_API.c:579 #3 0x082095bf in php_userstreamop_closedir (stream=0x3, close_handle=1) at /home/angio/php-5.1.4/main/streams/userspace.c:1266 #4 0x082009d4 in _php_stream_free (stream=0x842a43c, close_options=11) at /home/angio/php-5.1.4/main/streams/streams.c:342 #5 0x0820129c in stream_resource_regular_dtor (rsrc=0x3) at /home/angio/php-5.1.4/main/streams/streams.c:1373 #6 0x0823e8bf in list_entry_destructor (ptr=0x842c634) at /home/angio/php-5.1.4/Zend/zend_list.c:184 #7 0x0823d2ba in zend_hash_apply_deleter (ht=0x8374bc0, p=0x842c954) at /home/angio/php-5.1.4/Zend/zend_hash.c:576 #8 0x0823d387 in zend_hash_graceful_reverse_destroy (ht=0x8374bc0) at /home/angio/php-5.1.4/Zend/zend_hash.c:642 #9 0x0823165e in zend_deactivate () at /home/angio/php-5.1.4/Zend/zend.c:860 #10 0x081ec005 in php_request_shutdown (dummy=0x0) at /home/angio/php-5.1.4/main/main.c:1287 ---Type <return> to continue, or q <return> to quit--- #11 0x082b34db in main (argc=2, argv=0xbfb6cfb4) at /home/angio/php-5.1.4/sapi/cli/php_cli.c:1245 (gdb) -- Edit bug report at http://bugs.php.net/?id=38244&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38244&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38244&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38244&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38244&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38244&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38244&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38244&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38244&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38244&r=support Expected behavior: http://bugs.php.net/fix.php?id=38244&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38244&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38244&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38244&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38244&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38244&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38244&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38244&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38244&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38244&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38244&r=mysqlcfg