mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Improve the warning message for unpack() in case not enough values were provided (#10949)
This commit is contained in:
parent
0b212ab5ab
commit
6ec69d727a
4 changed files with 5 additions and 3 deletions
2
NEWS
2
NEWS
|
@ -151,6 +151,8 @@ PHP NEWS
|
||||||
. password_hash() will now chain the original RandomException to the ValueError
|
. password_hash() will now chain the original RandomException to the ValueError
|
||||||
on salt generation failure. (timwolla)
|
on salt generation failure. (timwolla)
|
||||||
. Fix GH-10239 (proc_close after proc_get_status always returns -1). (nielsdos)
|
. Fix GH-10239 (proc_close after proc_get_status always returns -1). (nielsdos)
|
||||||
|
. Improve the warning message for unpack() in case not enough values were
|
||||||
|
provided. (nielsdos)
|
||||||
|
|
||||||
- Streams:
|
- Streams:
|
||||||
. Fixed bug #51056: blocking fread() will block even if data is available.
|
. Fixed bug #51056: blocking fread() will block even if data is available.
|
||||||
|
|
|
@ -1178,7 +1178,7 @@ PHP_FUNCTION(unpack)
|
||||||
/* Reached end of input for '*' repeater */
|
/* Reached end of input for '*' repeater */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
php_error_docref(NULL, E_WARNING, "Type %c: not enough input, need %d, have " ZEND_LONG_FMT, type, size, inputlen - inputpos);
|
php_error_docref(NULL, E_WARNING, "Type %c: not enough input values, need %d values but only " ZEND_LONG_FMT " %s provided", type, size, inputlen - inputpos, inputlen - inputpos == 1 ? "was" : "were");
|
||||||
zend_array_destroy(Z_ARR_P(return_value));
|
zend_array_destroy(Z_ARR_P(return_value));
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ array(1) {
|
||||||
string(5) "str%c%c"
|
string(5) "str%c%c"
|
||||||
}
|
}
|
||||||
|
|
||||||
Warning: unpack(): Type a: not enough input, need 6, have 5 in %s on line %d
|
Warning: unpack(): Type a: not enough input values, need 6 values but only 5 were provided in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
array(1) {
|
array(1) {
|
||||||
[1]=>
|
[1]=>
|
||||||
|
|
|
@ -18,7 +18,7 @@ var_dump(
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: unpack(): Type Z: not enough input, need 2, have 1 in %s on line %d
|
Warning: unpack(): Type Z: not enough input values, need 2 values but only 1 was provided in %s on line %d
|
||||||
string(0) ""
|
string(0) ""
|
||||||
string(5) "foo%c%c"
|
string(5) "foo%c%c"
|
||||||
string(4) "foo%c"
|
string(4) "foo%c"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue