php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26816 Segmentation fault
Submitted: 2004-01-06 12:07 UTC Modified: 2004-01-06 12:10 UTC
From: pollmer at uni-sw dot gwdg dot de Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5CVS-2004-01-06 (dev) OS: SuSE Linux 9.0
Private report: No CVE-ID: None
 [2004-01-06 12:07 UTC] pollmer at uni-sw dot gwdg dot de
Description:
------------
Segmentation fault happens by running the script via command line and via apache 1.3.29.
Same behaviour using PHP 5.0.0b3 or 5.0.0b2.

./configure --prefix=/usr/local/php5 --with-apxs=/usr/local/apache/bin/apxs --enable-debug --enable-safe-mode --with-openssl=/usr --enable-bcmath --enable-calendar --with-libxml-dir=/usr/include/libxml2 --with-mysql=/usr --with-pgsql=/usr --enable-trans-id

(gdb) bt
#0  0x08212096 in zend_pzval_unlock_func (z=0x1)
    at /usr/local/src/php5-200401061430/Zend/zend_execute.c:64
#1  0x082125b6 in zend_switch_free (opline=0x404b72b8, Ts=0xbfffcea0)
    at /usr/local/src/php5-200401061430/Zend/zend_execute.c:202
#2  0x0820e6aa in zend_switch_free_handler (execute_data=0xbfffd000, 
    op_array=0x404b6628)
    at /usr/local/src/php5-200401061430/Zend/zend_execute.c:3093
#3  0x08208fb2 in execute (op_array=0x404b6628)
    at /usr/local/src/php5-200401061430/Zend/zend_execute.c:1264
#4  0x081e7770 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/local/src/php5-200401061430/Zend/zend.c:1050
#5  0x081a2ed5 in php_execute_script (primary_file=0xbffff400)
    at /usr/local/src/php5-200401061430/main/main.c:1642
#6  0x082165f4 in main (argc=2, argv=0xbffff494)
    at /usr/local/src/php5-200401061430/sapi/cli/php_cli.c:925


Reproduce code:
---------------
$string = "ab";

$strl = strlen( $string );
for ( $i =0; $i < $strl; $i++ ) {
    switch( $string[$i] ) {
        case 'a':
            echo 'a ';
            break;
        case 'b':
            echo 'b ';
            break;
    }
}

Expected result:
----------------
The output of the script should be:

a b


Actual result:
--------------
The output of the script is:

a Segmentation fault 


You'll get the output you want, if you use the script:

$string = "ab";

$strl = strlen( $string );
for ( $i =0; $i < $strl; $i++ ) {
    $string_i = $string[$i];
    switch( $string_i ) {
        case 'a':
            echo 'a ';
            break;
        case 'b':
            echo 'b ';
            break;
    }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-06 12:10 UTC] iliaa@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.

Dupe of bug #26696 and #26801 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 12:01:32 2024 UTC