Skip to content

Replace "unexpected character" warning with ParseError #4767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Zend/tests/warning_during_heredoc_scan_ahead.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ No warnings should be thrown during heredoc scan-ahead
<?php

<<<TEST
${x}
\400
${/*}
TEST;

?>
--EXPECTF--
Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d

Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d

Warning: Unterminated comment starting line %d in %s on line %d
Expand Down
9 changes: 1 addition & 8 deletions Zend/zend_language_scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -2834,14 +2834,7 @@ nowdoc_scan_done:
RETURN_TOKEN(END);
}

if (!SCNG(heredoc_scan_ahead)) {
zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
}
if (PARSER_MODE()) {
goto restart;
} else {
RETURN_TOKEN(T_BAD_CHARACTER);
}
RETURN_TOKEN(T_BAD_CHARACTER);
}

*/
Expand Down
10 changes: 2 additions & 8 deletions ext/tokenizer/tests/bad_character.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,21 @@ foreach ($codes as $code) {
echo $token, "\n";
}
}
echo "\n";
}

?>
--EXPECTF--
Warning: Unexpected character in input: ' in %s on line %d
--EXPECT--
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_WHITESPACE 1
T_STRING 3

Warning: Unexpected character in input: '%s' (ASCII=1) state=0 in %s on line %d
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_WHITESPACE 1
T_STRING 3

Warning: Unexpected character in input: '%s' (ASCII=1) state=0 in %s on line %d

Warning: Unexpected character in input: '%s' (ASCII=2) state=0 in %s on line %d

Warning: Unexpected character in input: '%s' (ASCII=3) state=0 in %s on line %d
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_BAD_CHARACTER 1
Expand Down
4 changes: 1 addition & 3 deletions tests/lang/bug71897.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ eval("

?>
--EXPECTF--
Warning: Unexpected character in input: '%s' (ASCII=127) state=0 in %s(%d) : eval()'d code on line %d

Parse error: syntax error, unexpected 'b' (T_STRING) in %s(%d) : eval()'d code on line %d
Parse error: syntax error, unexpected '%s' (T_BAD_CHARACTER) in %s on line %d