ID:               17150
 Updated by:       [EMAIL PROTECTED]
-Summary:          misstyped opendir segfaults apache
 Reported By:      [EMAIL PROTECTED]
 Status:           Analyzed
 Bug Type:         Directory function related
 Operating System: LInux 2.4.18
 PHP Version:      4.1.2
 New Comment:

it's not exclusive to opendir(). this blows up, too:

<?
$baz = fopen("/tmp/foo","w");
define("FOOBAR",$baz);
$foo=fopen("/tmp/bar", "w");
?>

(should you even be able to define() a resource? seems like a recipe
for trouble.)


Previous Comments:
------------------------------------------------------------------------

[2002-05-10 22:02:42] [EMAIL PROTECTED]

Reproduced, there's something weird going on:

$ ~/php/4.1.2d/bin/php -v
4.1.2

Program received signal SIGSEGV, Segmentation fault.
0x0811565b in zend_hash_index_find (ht=0x81893c4, h=1,
pData=0xbffff0c8) at zend_hash.c:935
935                     if ((p->h == h) && (p->nKeyLength == 0)) {
(gdb) bt
#0  0x0811565b in zend_hash_index_find (ht=0x81893c4, h=1,
pData=0xbffff0c8) at zend_hash.c:935
#1  0x081161af in _zend_list_delete (id=1) at zend_list.c:53
#2  0x0810dc61 in _zval_dtor (zvalue=0x81aed20,
__zend_filename=0x815f0b1 "zend_constants.c", __zend_lineno=32) at
zend_variables.c:64
#3  0x08104a35 in free_zend_constant (c=0x81aed20) at
zend_constants.c:32
#4  0x0811458e in zend_hash_del_key_or_index (ht=0x8189cd8,
arKey=0x81ad710 "foobar", nKeyLength=7, h=1711630034, flag=0) at
zend_hash.c:512
#5  0x08114e27 in zend_hash_reverse_apply (ht=0x8189cd8,
apply_func=0x8104ae8 <clean_non_persistent_constant>) at
zend_hash.c:741
#6  0x08104e46 in clean_non_persistent_constants () at
zend_constants.c:166
#7  0x08105677 in shutdown_executor () at zend_execute_API.c:199
#8  0x0810ee66 in zend_deactivate () at zend.c:600
#9  0x0805f65f in php_request_shutdown (dummy=0x0) at main.c:735
#10 0x0805dfb3 in main (argc=3, argv=0xbffffb04) at cgi_main.c:776
#11 0x400bb6cf in __libc_start_main () from /lib/libc.so.6

$ php -v
PHP 4.3.0-dev (cli)
Zend Engine v1.2.1, Copyright (c) 1998-2002 Zend Technologies

$ php -f 17150.php 
/home/mfischer/isrc/cvs/php4/Zend/zend_hash.c(948) : ht=0x081f5864 is
already destroyed


------------------------------------------------------------------------

[2002-05-10 21:39:57] [EMAIL PROTECTED]

This probably doesn't matter much but.
Due to a faulty copy/paste on a script, i noticed that apache segfaults
on the following code:
<? 
define("FOOBAR",opendir("/tmp/"));
$foo=opendir("/etc/");
?>

Obviously this code is incorrect, but still you might find usefull to
correct the segfault.

error.log:
[Sat May 11 02:32:51 2002] [notice] child pid 13397 exit signal
Segmentation fault (11)
(repeats)

Regards,

Joao Gouveia

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17150&edit=1

Reply via email to