Skip to content

Commit d7184ff

Browse files
committed
Support compile_string skip INITIAL
1 parent 218fd03 commit d7184ff

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Zend/zend_globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct _zend_compiler_globals {
9494
struct _zend_ini_parser_param *ini_parser_param;
9595

9696
bool skip_shebang;
97+
bool skip_initial;
9798
bool increment_lineno;
9899

99100
bool variable_width_locale; /* UTF-8, Shift-JIS, Big5, ISO 2022, EUC, etc */

Zend/zend_language_scanner.l

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,11 @@ zend_op_array *compile_string(zend_string *source_string, const char *filename)
799799
filename_str = zend_string_init(filename, strlen(filename), 0);
800800
zend_prepare_string_for_scanning(&tmp, filename_str);
801801
zend_string_release(filename_str);
802-
BEGIN(ST_IN_SCRIPTING);
802+
if (CG(skip_initial)) {
803+
BEGIN(INITIAL);
804+
} else {
805+
BEGIN(ST_IN_SCRIPTING);
806+
}
803807
op_array = zend_compile(ZEND_EVAL_CODE);
804808

805809
zend_restore_lexical_state(&original_lex_state);

0 commit comments

Comments
 (0)