com php-src: Return FALSE if error_log fails to write all bytes: ext/standard/basic_functions.c

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    98f4ce9363b013fbaaa9f417e5bf276f5cbe7017
Author:    Adam Saponara <[email protected]>         Thu, 9 Mar 2017 14:27:01 -0500
Committer: Nikita Popov <[email protected]>      Thu, 16 Mar 2017 12:56:36 +0100
Parents:   7fba8bda4c9e89c522e5d27a38489125e36b9904
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=98f4ce9363b013fbaaa9f417e5bf276f5cbe7017

Log:
Return FALSE if error_log fails to write all bytes

Changed paths:
  M  ext/standard/basic_functions.c


Diff:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 2f39f51..37d24d4 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4682,6 +4682,7 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers)
 PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers) /* {{{ */
 {
 	php_stream *stream = NULL;
+	size_t nbytes;
 
 	switch (opt_err)
 	{
@@ -4701,8 +4702,11 @@ PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, cha
 			if (!stream) {
 				return FAILURE;
 			}
-			php_stream_write(stream, message, message_len);
+			nbytes = php_stream_write(stream, message, message_len);
 			php_stream_close(stream);
+			if (nbytes != message_len) {
+				return FAILURE;
+			}
 			break;
 
 		case 4: /* send to SAPI */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.