cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests closure_027.phpt closure_032.phpt

[email protected] ("Johannes Schl??ter")
Newsgroups php.zend-engine.cvs
Message-ID <cvsjohannes1225740512@cvsserver>
johannes		Mon Nov  3 19:28:32 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /ZendEngine2/tests	closure_032.phpt 

  Modified files:              
    /ZendEngine2	zend_compile.c 
    /ZendEngine2/tests	closure_027.phpt 
  Log:
  MFH: Use a better function name for closure related errors and debug_backtrace()
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.85&r2=1.647.2.27.2.41.2.86&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.85 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.86
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.85	Fri Aug 29 10:17:08 2008
+++ ZendEngine2/zend_compile.c	Mon Nov  3 19:28:32 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.85 2008/08/29 10:17:08 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.86 2008/11/03 19:28:32 johannes Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -1387,7 +1387,7 @@
 	zend_op       *current_op;
 
 	function_name.op_type = IS_CONST;
-	ZVAL_STRINGL(&function_name.u.constant, "", sizeof("")-1, 1);
+	ZVAL_STRINGL(&function_name.u.constant, "{closure}", sizeof("{closure}")-1, 1);
 
 	zend_do_begin_function_declaration(function_token, &function_name, 0, return_reference, NULL TSRMLS_CC);
 
@@ -1402,7 +1402,7 @@
 	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;
 }
 
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/closure_027.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: ZendEngine2/tests/closure_027.phpt
diff -u ZendEngine2/tests/closure_027.phpt:1.1.2.2 ZendEngine2/tests/closure_027.phpt:1.1.2.3
--- ZendEngine2/tests/closure_027.phpt:1.1.2.2	Mon Jul 28 14:10:00 2008
+++ ZendEngine2/tests/closure_027.phpt	Mon Nov  3 19:28:32 2008
@@ -25,7 +25,7 @@
 
 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

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/closure_032.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/closure_032.phpt
+++ ZendEngine2/tests/closure_032.phpt
--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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.