summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2008-11-03 19:27:48 +0000
committerJohannes Schlüter <johannes@php.net>2008-11-03 19:27:48 +0000
commit23e04b542c586312d32204d94ece3c54e6633302 (patch)
tree2c3b4b6d1085dc001273123688e1ee3e03fd4b6b
parent8d07d7b8e7f54b1f32c178d12880117a551b62f8 (diff)
downloadphp-git-23e04b542c586312d32204d94ece3c54e6633302.tar.gz
Use a better function name for closure related errors and debug_backtrace()
-rw-r--r--Zend/tests/closure_027.phpt2
-rw-r--r--Zend/tests/closure_032.phpt65
-rw-r--r--Zend/zend_compile.c4
3 files changed, 68 insertions, 3 deletions
diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt
index 7787f729e5..f26e114045 100644
--- a/Zend/tests/closure_027.phpt
+++ b/Zend/tests/closure_027.phpt
@@ -25,7 +25,7 @@ NULL
Notice: Undefined variable: y in %s on line %d
-Warning: Missing argument 1 for (), called in %s on line %d and defined in %s on line %d
+Warning: Missing argument 1 for {closure}(), called in %s on line %d and defined in %s on line %d
NULL
Catchable fatal error: Argument 1 passed to test() must be an instance of Closure, instance of stdClass given, called in %s on line %d and defined in %s on line %d
diff --git a/Zend/tests/closure_032.phpt b/Zend/tests/closure_032.phpt
new file mode 100644
index 0000000000..6072f0d8d1
--- /dev/null
+++ b/Zend/tests/closure_032.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Closure 032: Testing Closure and debug_backtrace
+--FILE--
+<?php
+
+function test(closure $a) {
+ $a(23);
+}
+
+
+$c = function($param) { print_r(debug_backtrace()); debug_print_backtrace(); };
+
+$c(23);
+test($c);
+?>
+--EXPECTF--
+Array
+(
+ [0] => Array
+ (
+ [file] => %s
+ [line] => %d
+ [function] => {closure}
+ [args] => Array
+ (
+ [0] => 23
+ )
+
+ )
+
+)
+#0 {closure}(23) called at [%s:%d]
+Array
+(
+ [0] => Array
+ (
+ [file] => %s
+ [line] => %d
+ [function] => {closure}
+ [args] => Array
+ (
+ [0] => 23
+ )
+
+ )
+
+ [1] => Array
+ (
+ [file] => %s
+ [line] => %d
+ [function] => test
+ [args] => Array
+ (
+ [0] => Closure Object
+ (
+ )
+
+ )
+
+ )
+
+)
+#0 {closure}(23) called at [%s:%d]
+#1 test(Closure Object ()) called at [%s:%d]
+
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 956992049e..da547211b5 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1460,7 +1460,7 @@ void zend_do_begin_lambda_function_declaration(znode *result, znode *function_to
zend_op *current_op;
function_name.op_type = IS_CONST;
- ZVAL_ASCII_STRING(&function_name.u.constant, "", ZSTR_DUPLICATE);
+ ZVAL_ASCII_STRING(&function_name.u.constant, "{closure}", ZSTR_DUPLICATE);
zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC);
@@ -1475,7 +1475,7 @@ void zend_do_begin_lambda_function_declaration(znode *result, znode *function_to
if (is_static) {
CG(active_op_array)->fn_flags |= ZEND_ACC_STATIC;
}
- CG(active_op_array)->fn_flags |= ZEND_ACC_CLOSURE;
+ CG(active_op_array)->fn_flags |= ZEND_ACC_CLOSURE;
}
/* }}} */