Skip to content

Commit 98f4ce9

Browse files
adsrnikic
authored andcommitted
Return FALSE if error_log fails to write all bytes
1 parent 7fba8bd commit 98f4ce9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/standard/basic_functions.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4682,6 +4682,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers)
46824682
PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers) /* {{{ */
46834683
{
46844684
php_stream *stream = NULL;
4685+
size_t nbytes;
46854686

46864687
switch (opt_err)
46874688
{
@@ -4701,8 +4702,11 @@ PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, cha
47014702
if (!stream) {
47024703
return FAILURE;
47034704
}
4704-
php_stream_write(stream, message, message_len);
4705+
nbytes = php_stream_write(stream, message, message_len);
47054706
php_stream_close(stream);
4707+
if (nbytes != message_len) {
4708+
return FAILURE;
4709+
}
47064710
break;
47074711

47084712
case 4: /* send to SAPI */

0 commit comments

Comments
 (0)