php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38244 Calling opendir() causes a SEGV
Submitted: 2006-07-28 19:38 UTC Modified: 2006-07-31 09:07 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: agiorgio at optonline dot net Assigned: pollita (profile)
Status: Not a bug Package: Reproducible crash
PHP Version: 5.1.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: agiorgio at optonline dot net
New email:
PHP Version: OS:

 

 [2006-07-28 19:38 UTC] agiorgio at optonline dot net
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)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-31 09:07 UTC] mike@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

It's not directly opendir() but happens on shutdown,
thus it's a duplicate of bug #36320
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 11:01:31 2024 UTC