ID:               28487
 Comment by:       jb-php at microbasic dot net
 Reported By:      tomas dot matousek at matfyz dot cz
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: WinXP
 PHP Version:      5.0.0RC2
 New Comment:

I have the same problem, example :
<?
$somecode=1;
switch($somecode){
        case 1:
                function test(){
                        echo "success";
                }
                test();
                break;
}
?>
With php5 final, this code was working with php 4.3.7


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

[2004-07-13 18:07:43] fixxxer at php5 dot ru

The bug exists in the last snapshot php5-200407131230.
Tested under FreeBSD 4.9 and Windows XP.

(gdb) bt
#0  zend_switch_free_handler (execute_data=0xbfbfe314,
opline=0x84f8824, op_array=0x8504780)
    at /usr/ports/lang/php5/work/php-5.0.0RC3/Zend/zend_execute.c:65
#1  0x823fbcf in execute (op_array=0x8504780) at
/usr/ports/lang/php5/work/php-5.0.0RC3/Zend/zend_execute.c:1391
#2  0x825d8c5 in zend_do_fcall_common_helper (execute_data=0xbfbfe404,
opline=0x850e368, op_array=0x8505124)
    at /usr/ports/lang/php5/work/php-5.0.0RC3/Zend/zend_execute.c:2728
#3  0x825dd22 in zend_do_fcall_by_name_handler
(execute_data=0xbfbfe404, opline=0x850e368, op_array=0x8505124)
    at /usr/ports/lang/php5/work/php-5.0.0RC3/Zend/zend_execute.c:2810
#4  0x823fbcf in execute (op_array=0x8505124) at
/usr/ports/lang/php5/work/php-5.0.0RC3/Zend/zend_execute.c:1391
#5  0x821e32e in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/ports/lang/php5/work/php-5.0.0RC3/Zend/zend.c:1061
#6  0x81e3ba5 in php_execute_script (primary_file=0xbfbffac0) at
/usr/ports/lang/php5/work/php-5.0.0RC3/main/main.c:1627
#7  0x82688ce in main (argc=3, argv=0xbfbffb3c) at
/usr/ports/lang/php5/work/php-5.0.0RC3/sapi/cli/php_cli.c:943

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

[2004-05-22 12:54:44] tomas dot matousek at matfyz dot cz

Description:
------------
PHP crashes when an arbitrary function declared in a switch statement
is called.

Reproduce code:
---------------
<?
$x = 1;

switch($x)
{
  case 1:
    function f() { }
  
    break;  
}

f();
?>

Expected result:
----------------
no crash

Actual result:
--------------
crash


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


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

Reply via email to