@@ -210,6 +210,7 @@ void shutdown_scanner(void)
210210 zend_ptr_stack_destroy (&SCNG (heredoc_label_stack));
211211 SCNG (heredoc_scan_ahead) = 0 ;
212212 SCNG (on_event) = NULL ;
213+ SCNG (on_event_context) = NULL ;
213214}
214215
215216ZEND_API void zend_save_lexical_state (zend_lex_state *lex_state)
@@ -581,6 +582,8 @@ ZEND_API zend_result open_file_for_scanning(zend_file_handle *file_handle)
581582 zend_set_compiled_filename (compiled_filename);
582583 zend_string_release_ex (compiled_filename, 0 );
583584
585+ SCNG (on_event) = NULL ;
586+ SCNG (on_event_context) = NULL ;
584587 RESET_DOC_COMMENT ();
585588 CG (zend_lineno) = 1 ;
586589 CG (increment_lineno) = 0 ;
@@ -766,6 +769,8 @@ ZEND_API void zend_prepare_string_for_scanning(zval *str, zend_string *filename)
766769 zend_set_compiled_filename (filename);
767770 CG (zend_lineno) = 1 ;
768771 CG (increment_lineno) = 0 ;
772+ SCNG (on_event) = NULL ;
773+ SCNG (on_event_context) = NULL ;
769774 RESET_DOC_COMMENT ();
770775}
771776
@@ -1636,6 +1641,9 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16361641<ST_IN_SCRIPTING>" (" {TABS_AND_SPACES}(" integer" ){TABS_AND_SPACES}" )" {
16371642 if (PARSER_MODE ()) {
16381643 zend_error (E_DEPRECATED, " Non-canonical cast (integer) is deprecated, use the (int) cast instead" );
1644+ if (PARSER_MODE () && EG (exception)) {
1645+ RETURN_TOKEN (T_ERROR);
1646+ }
16391647 }
16401648 RETURN_TOKEN (T_INT_CAST);
16411649}
@@ -1647,6 +1655,9 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16471655<ST_IN_SCRIPTING>" (" {TABS_AND_SPACES}(" double" ){TABS_AND_SPACES}" )" {
16481656 if (PARSER_MODE ()) {
16491657 zend_error (E_DEPRECATED, " Non-canonical cast (double) is deprecated, use the (float) cast instead" );
1658+ if (PARSER_MODE () && EG (exception)) {
1659+ RETURN_TOKEN (T_ERROR);
1660+ }
16501661 }
16511662 RETURN_TOKEN (T_DOUBLE_CAST);
16521663}
@@ -1666,6 +1677,9 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16661677<ST_IN_SCRIPTING>" (" {TABS_AND_SPACES}(" binary" ){TABS_AND_SPACES}" )" {
16671678 if (PARSER_MODE ()) {
16681679 zend_error (E_DEPRECATED, " Non-canonical cast (binary) is deprecated, use the (string) cast instead" );
1680+ if (PARSER_MODE () && EG (exception)) {
1681+ RETURN_TOKEN (T_ERROR);
1682+ }
16691683 }
16701684 RETURN_TOKEN (T_STRING_CAST);
16711685}
@@ -1685,6 +1699,9 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
16851699<ST_IN_SCRIPTING>" (" {TABS_AND_SPACES}(" boolean" ){TABS_AND_SPACES}" )" {
16861700 if (PARSER_MODE ()) {
16871701 zend_error (E_DEPRECATED, " Non-canonical cast (boolean) is deprecated, use the (bool) cast instead" );
1702+ if (PARSER_MODE () && EG (exception)) {
1703+ RETURN_TOKEN (T_ERROR);
1704+ }
16881705 }
16891706 RETURN_TOKEN (T_BOOL_CAST);
16901707}
@@ -2741,6 +2758,7 @@ skip_escape_conversion:
27412758 SCNG(heredoc_scan_ahead) = 1;
27422759 SCNG(heredoc_indentation) = 0;
27432760 SCNG(heredoc_indentation_uses_spaces) = 0;
2761+ SCNG(on_event_context) = NULL;
27442762 LANG_SCNG(on_event) = NULL;
27452763 CG(doc_comment) = NULL;
27462764
0 commit comments