]> granicus.if.org Git - php/commitdiff
Move =&new deprecation message into compiler
authorNikita Popov <nikic@php.net>
Tue, 26 Aug 2014 20:53:41 +0000 (22:53 +0200)
committerNikita Popov <nikic@php.net>
Tue, 26 Aug 2014 21:36:53 +0000 (23:36 +0200)
Zend/zend_compile.c
Zend/zend_language_parser.y

index 545b8406724bd3bce5332c99e95289e7e4c78df6..b9b06f019e1ba03891813e94e0dcc42be5988155 100644 (file)
@@ -3879,6 +3879,7 @@ void zend_compile_assign_ref(znode *result, zend_ast *ast TSRMLS_DC) {
        if (zend_is_call(source_ast)) {
                opline->extended_value = ZEND_RETURNS_FUNCTION;
        } else if (source_ast->kind == ZEND_AST_NEW) {
+               zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated");
                opline->extended_value = ZEND_RETURNS_NEW;
        }
 }
index 00ebeca557cda66e562517c8c59d9663610a778d..e86e5e2fa1d65713647838050d242919c7f2791b 100644 (file)
@@ -760,10 +760,8 @@ expr_without_variable:
                        { $$ = zend_ast_create(ZEND_AST_ASSIGN, $1, $3); }
        |       variable '=' '&' variable
                        { $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1, $4); }
-       |       variable '=' '&' T_NEW class_name_reference ctor_arguments
-                       { zend_error(E_DEPRECATED, "Assigning the return value of new by reference is deprecated");
-                         $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1,
-                             zend_ast_create(ZEND_AST_NEW, $5, $6)); }
+       |       variable '=' '&' new_expr
+                       { $$ = zend_ast_create(ZEND_AST_ASSIGN_REF, $1, $4); }
        |       T_CLONE expr { $$ = zend_ast_create(ZEND_AST_CLONE, $2); }
        |       variable T_PLUS_EQUAL expr
                        { $$ = zend_ast_create_assign_op(ZEND_ASSIGN_ADD, $1, $3); }