Skip to content

Commit c695b1d

Browse files
authored
Improve error message for too long file in ext/tidy (#14870)
As suggested in #14862 (comment)
1 parent 2f97ad9 commit c695b1d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

ext/tidy/tests/parsing_file_too_large.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ unlink($path);
6161
?>
6262
--EXPECT--
6363
int(0)
64-
ValueError: Input string is too long
65-
ValueError: Input string is too long
66-
ValueError: Input string is too long
67-
ValueError: tidy_repair_file(): Argument #1 ($filename) Input string is too long
64+
ValueError: File content is too long
65+
ValueError: File content is too long
66+
ValueError: File content is too long
67+
ValueError: tidy_repair_file(): Argument #1 ($filename) File content is too long

ext/tidy/tidy.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, bool is_file)
306306
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(data))) {
307307
if (is_file) {
308308
zend_string_release_ex(data, false);
309-
zend_argument_value_error(1, "Input string is too long");
309+
zend_argument_value_error(1, "File content is too long");
310310
} else {
311311
zend_argument_value_error(1, "is too long");
312312
}
@@ -973,7 +973,7 @@ static zend_result php_tidy_output_handler(void **nothing, php_output_context *o
973973
tidyOptSetBool(doc, TidyMark, no);
974974

975975
if (ZEND_SIZE_T_UINT_OVFL(output_context->in.used)) {
976-
php_error_docref(NULL, E_WARNING, "Input string is too long");
976+
php_error_docref(NULL, E_WARNING, "File content is too long");
977977
return status;
978978
}
979979

@@ -1086,7 +1086,7 @@ PHP_FUNCTION(tidy_parse_file)
10861086

10871087
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(contents))) {
10881088
zend_string_release_ex(contents, 0);
1089-
zend_value_error("Input string is too long");
1089+
zend_value_error("File content is too long");
10901090
RETURN_THROWS();
10911091
}
10921092

@@ -1384,7 +1384,7 @@ PHP_METHOD(tidy, __construct)
13841384

13851385
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(contents))) {
13861386
zend_string_release_ex(contents, 0);
1387-
zend_value_error("Input string is too long");
1387+
zend_value_error("File content is too long");
13881388
RETURN_THROWS();
13891389
}
13901390

@@ -1423,7 +1423,7 @@ PHP_METHOD(tidy, parseFile)
14231423

14241424
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(contents))) {
14251425
zend_string_release_ex(contents, 0);
1426-
zend_value_error("Input string is too long");
1426+
zend_value_error("File content is too long");
14271427
RETURN_THROWS();
14281428
}
14291429

0 commit comments

Comments
 (0)