From: agiorgio at optonline dot net
Operating system: Linux
PHP version: 5.1.4
PHP Bug Type: Reproducible crash
Bug description: Calling readdir() causes a SEGV
Description:
------------
Calling readdir() causes PHP to crash.
Reproduce code:
---------------
class mystream
{
function dir_opendir($url, $options)
{
return true;
}
}
stream_wrapper_register("test", "mystream");
$dir = opendir("test://a");
readdir($dir);
Expected result:
----------------
PHP should not crash.
Actual result:
--------------
(gdb) run
Starting program: /home/angio/php-5.1.4/sapi/cli/php ~/test.php
Warning: readdir(): mystream::dir_readdir is not implemented! in
/home/angio/test.php on line 14
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) 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=0xbfbeb4b0, 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=0x842c164, 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=0x842bf7c)
at /home/angio/php-5.1.4/Zend/zend_list.c:184
#7 0x0823d2ba in zend_hash_apply_deleter (ht=0x8374bc0, p=0x842c06c)
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
#11 0x082b34db in main (argc=2, argv=0xbfbec1f4)
at /home/angio/php-5.1.4/sapi/cli/php_cli.c:1245
--
Edit bug report at http://bugs.php.net/?id=38246&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38246&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38246&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38246&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38246&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38246&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38246&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38246&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38246&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38246&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38246&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38246&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38246&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38246&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38246&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38246&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38246&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38246&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38246&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38246&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38246&r=mysqlcfg