mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-21058: error_log() crash on null destination argument. (#21064)
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex handling the null path and propagating the exception. close GH-21064
This commit is contained in:
2
NEWS
2
NEWS
@@ -101,6 +101,8 @@ PHP NEWS
|
|||||||
while COW violation flag is still set). (alexandre-daubois)
|
while COW violation flag is still set). (alexandre-daubois)
|
||||||
. Invalid mode values now throw in array_filter() instead of being silently
|
. Invalid mode values now throw in array_filter() instead of being silently
|
||||||
defaulted to 0. (Jorg Sowa)
|
defaulted to 0. (Jorg Sowa)
|
||||||
|
. Fixed bug GH-21058 (error_log() crashes with message_type 3 and
|
||||||
|
null destination). (David Carlier)
|
||||||
|
|
||||||
- Streams:
|
- Streams:
|
||||||
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
|
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
|
||||||
|
|||||||
@@ -1369,7 +1369,7 @@ PHPAPI zend_result _php_error_log(int opt_err, const zend_string *message, const
|
|||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
||||||
case 3: /*save to a file */
|
case 3: /*save to a file */
|
||||||
stream = php_stream_open_wrapper(ZSTR_VAL(opt), "a", REPORT_ERRORS, NULL);
|
stream = php_stream_open_wrapper(opt ? ZSTR_VAL(opt) : NULL, "a", REPORT_ERRORS, NULL);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
13
ext/standard/tests/general_functions/gh21058.phpt
Normal file
13
ext/standard/tests/general_functions/gh21058.phpt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
--TEST--
|
||||||
|
GH-21058 (error_log() crash with null destination and message type 3)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
error_log("test", 3, null);
|
||||||
|
} catch (\ValueError $e) {
|
||||||
|
echo $e->getMessage(), PHP_EOL;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Path must not be empty
|
||||||
Reference in New Issue
Block a user