File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ --TEST--
2+ (unset) cast must not be allowed in constant expressions
3+ --CREDITS--
4+ Viet Hoang Luu (@vi3tL0u1s)
5+ --FILE--
6+ <?php
7+ try {
8+ class C {
9+ public $ p = (unset ) C::class;
10+ }
11+ new C ;
12+ } catch (Error $ e ) {
13+ echo $ e ->getMessage ();
14+ }
15+ ?>
16+ --EXPECTF--
17+ Fatal error: The (unset) cast is no longer supported in %s on line %d
Original file line number Diff line number Diff line change @@ -12564,6 +12564,9 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1256412564 zend_eval_const_expr (& ast -> child [1 ]);
1256512565 return ;
1256612566 case ZEND_AST_CAST :
12567+ if (ast -> attr == IS_NULL ) {
12568+ zend_error_noreturn (E_COMPILE_ERROR , "The (unset) cast is no longer supported" );
12569+ }
1256712570 zend_eval_const_expr (& ast -> child [0 ]);
1256812571 if (ast -> child [0 ]-> kind == ZEND_AST_ZVAL
1256912572 && zend_try_ct_eval_cast (& result , ast -> attr , zend_ast_get_zval (ast -> child [0 ]))) {
You can’t perform that action at this time.
0 commit comments