Skip to content

Commit 617edaf

Browse files
committed
Fix GH-20871: Improve error messages for invalid -d command-line options
1 parent 2dd463f commit 617edaf

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Zend/zend_ini_parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static ZEND_COLD void ini_error(const char *msg)
206206
error_buf = (char *) emalloc(error_buf_len);
207207

208208
if (strcmp(currently_parsed_filename, "Unknown") == 0 && CG(ini_parser_unbuffered_errors)) {
209-
sprintf(error_buf, "%s in -d option on line 0\n", msg);
209+
sprintf(error_buf, "%s in INI command line parameter '-d'\n", msg);
210210
} else {
211211
sprintf(error_buf, "%s in %s on line %" PRIu32 "\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno());
212212
}

sapi/cli/tests/gh20871.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ print_r($output2);
1818
--EXPECTF--
1919
Array
2020
(
21-
[0] => PHP: syntax error, unexpected '=' in -d option on line 0
21+
[0] => PHP: syntax error, unexpected '=' in INI command line parameter '-d'
2222
[1] => hello
2323
)
2424

2525
Array
2626
(
27-
[0] => PHP: syntax error, unexpected '!' in -d option on line 0
27+
[0] => PHP: syntax error, unexpected '!' in INI command line parameter '-d'
2828
[1] => world
2929
)

0 commit comments

Comments
 (0)