From:             phpbugs at thequod dot de
Operating system: Ubuntu Linux
PHP version:      5CVS-2006-11-02 (CVS)
PHP Bug Type:     Reproducible crash
Bug description:  Segfault with implode("\n", array(false))

Description:
------------
When imploding/joining an array with only "false" in it, 
PHP segfaults (on shutdown?).

I've found this in a more complex use case, where it 
segfaulted during execution, but probably because of this 
root problem.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208198976 (LWP 4071)]
0x083dd4f0 in _zval_dtor_func (zvalue=0xb7ebd8ec, 
__zend_filename=0x868524c "/usr/local/src/PHP_5_2/Zend/zend_variables.h",

__zend_lineno=35) 
at /usr/local/src/PHP_5_2/Zend/zend_variables.c:35
35                              
CHECK_ZVAL_STRING_REL(zvalue);
(gdb) bt
#0  0x083dd4f0 in _zval_dtor_func (zvalue=0xb7ebd8ec, 
__zend_filename=0x868524c "/usr/local/src/PHP_5_2/Zend/zend_variables.h",

__zend_lineno=35) 
at /usr/local/src/PHP_5_2/Zend/zend_variables.c:35
#1  0x083d02f8 in _zval_dtor (zvalue=0xb7ebd8ec, 
__zend_filename=0x86851e4
"/usr/local/src/PHP_5_2/Zend/zend_execute_API.c", 
__zend_lineno=414) 
at /usr/local/src/PHP_5_2/Zend/zend_variables.h:35
#2  0x083d04ba in _zval_ptr_dtor (zval_ptr=0xb7ebd92c, 
__zend_filename=0x8686238 "/usr/local/src/PHP_5_2/Zend/zend_variables.c",

__zend_lineno=175) 
at /usr/local/src/PHP_5_2/Zend/zend_execute_API.c:414
#3  0x083dd92c in _zval_ptr_dtor_wrapper 
(zval_ptr=0xb7ebd92c) 
at /usr/local/src/PHP_5_2/Zend/zend_variables.c:175
#4  0x083eb689 in zend_hash_apply_deleter (ht=0x86e2bb0, 
p=0xb7ebd920) 
at /usr/local/src/PHP_5_2/Zend/zend_hash.c:606
#5  0x083eb80d in zend_hash_graceful_reverse_destroy 
(ht=0x86e2bb0) 
at /usr/local/src/PHP_5_2/Zend/zend_hash.c:641
#6  0x083cff2b in shutdown_executor () 
at /usr/local/src/PHP_5_2/Zend/zend_execute_API.c:239
#7  0x083df05a in zend_deactivate () 
at /usr/local/src/PHP_5_2/Zend/zend.c:840
#8  0x0838b2fc in php_request_shutdown (dummy=0x0) 
at /usr/local/src/PHP_5_2/main/main.c:1300
#9  0x0845807b in main (argc=3, argv=0xbf81bf24) 
at /usr/local/src/PHP_5_2/sapi/cli/php_cli.c:1259


Reproduce code:
---------------
<?php
$a = array(false);

$b = join("\n", $a);

var_dump($b);

echo 'bar';

?>


Expected result:
----------------
string(0) ""
bar

(PHP 5.1.6)

Actual result:
--------------
string(0) ""
barSegmentation fault (core dumped)

(PHP_5_2)

-- 
Edit bug report at http://bugs.php.net/?id=39350&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39350&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39350&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39350&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39350&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39350&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39350&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39350&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39350&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39350&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39350&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39350&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39350&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39350&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39350&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39350&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39350&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39350&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39350&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39350&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39350&r=mysqlcfg

Reply via email to