summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-04-25 09:56:42 +0000
committerDmitry Stogov <dmitry@php.net>2005-04-25 09:56:42 +0000
commit35b38598ccb521a59a98389cd776875630e81988 (patch)
treec063eabe727f000ca83d63f3cb26ea60f1c6b458 /Zend
parentcbe6261882aab048bee3094a7274b1da80e8525e (diff)
downloadphp-git-35b38598ccb521a59a98389cd776875630e81988.tar.gz
Fixed bug #29944 (Function defined in switch, crashes).
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/bug29944.phpt16
-rw-r--r--Zend/zend_compile.c2
2 files changed, 17 insertions, 1 deletions
diff --git a/Zend/tests/bug29944.phpt b/Zend/tests/bug29944.phpt
new file mode 100644
index 0000000000..6c0cf1ec7a
--- /dev/null
+++ b/Zend/tests/bug29944.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #29944 (Function defined in switch, crashes)
+--FILE--
+<?php
+$a = 1;
+switch ($a) {
+ case 1:
+ function foo($a) {
+ return "ok\n";
+ }
+ echo foo($a);
+}
+?>
+--EXPECT--
+ok
+
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index e1c2637b52..41c0104979 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1530,7 +1530,7 @@ static int generate_free_switch_expr(zend_switch_entry *switch_entry TSRMLS_DC)
zend_op *opline;
if (switch_entry->cond.op_type != IS_VAR && switch_entry->cond.op_type != IS_TMP_VAR) {
- return 0;
+ return (switch_entry->cond.op_type == IS_UNUSED);
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);