@@ -11309,7 +11309,7 @@ static void zend_compile_array(znode *result, zend_ast *ast) /* {{{ */
1130911309}
1131011310/* }}} */
1131111311
11312- static void zend_compile_const (znode * result , const zend_ast * ast ) /* {{{ */
11312+ static zend_op * zend_compile_const_inner (znode * result , const zend_ast * ast , bool use_tmp ) /* {{{ */
1131311313{
1131411314 zend_ast * name_ast = ast -> child [0 ];
1131511315
@@ -11333,17 +11333,21 @@ static void zend_compile_const(znode *result, const zend_ast *ast) /* {{{ */
1133311333 result -> op_type = IS_CONST ;
1133411334 ZVAL_LONG (& result -> u .constant , Z_LVAL_P (zend_ast_get_zval (last -> child [0 ])));
1133511335 zend_string_release_ex (resolved_name , 0 );
11336- return ;
11336+ return NULL ;
1133711337 }
1133811338 }
1133911339
1134011340 if (zend_try_ct_eval_const (& result -> u .constant , resolved_name , is_fully_qualified )) {
1134111341 result -> op_type = IS_CONST ;
1134211342 zend_string_release_ex (resolved_name , 0 );
11343- return ;
11343+ return NULL ;
1134411344 }
1134511345
11346- opline = zend_emit_op_tmp (result , ZEND_FETCH_CONSTANT , NULL , NULL );
11346+ if (use_tmp ) {
11347+ opline = zend_emit_op_tmp (result , ZEND_FETCH_CONSTANT , NULL , NULL );
11348+ } else {
11349+ opline = zend_emit_op (result , ZEND_FETCH_CONSTANT , NULL , NULL );
11350+ }
1134711351 opline -> op2_type = IS_CONST ;
1134811352
1134911353 if (is_fully_qualified || !FC (current_namespace )) {
@@ -11356,6 +11360,13 @@ static void zend_compile_const(znode *result, const zend_ast *ast) /* {{{ */
1135611360 resolved_name , true);
1135711361 }
1135811362 opline -> extended_value = zend_alloc_cache_slot ();
11363+ return opline ;
11364+ }
11365+ /* }}} */
11366+
11367+ static void zend_compile_const (znode * result , const zend_ast * ast ) /* {{{ */
11368+ {
11369+ zend_compile_const_inner (result , ast , true);
1135911370}
1136011371/* }}} */
1136111372
@@ -12314,6 +12325,8 @@ static zend_op *zend_compile_var_inner(znode *result, zend_ast *ast, uint32_t ty
1231412325 case ZEND_AST_ASSIGN :
1231512326 zend_compile_assign (result , ast , false, type );
1231612327 return NULL ;
12328+ case ZEND_AST_CONST :
12329+ return zend_compile_const_inner (result , ast , false);
1231712330 default :
1231812331 if (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET ) {
1231912332 zend_error_noreturn (E_COMPILE_ERROR ,
0 commit comments