com php-src: fixed fwrite: ext/standard/file.c
| From: | Anatol Belski | Date: | Thu, 22 Aug 2013 07:54:45 +0000 |
| Subject: | com php-src: fixed fwrite: ext/standard/file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73614@lists.php.net to get a copy of this message | ||
Commit: ea56c2dcfddfa991264f392c6c5a485926a65418
Author: Anatol Belski <ab@php.net> Thu, 22 Aug 2013 00:54:45 -0700
Parents: 09c3b6c1b62f6ebb9d87da3c36439d0e5ee4f5dc
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ea56c2dcfddfa991264f392c6c5a485926a65418
Log:
fixed fwrite
Changed paths:
M ext/standard/file.c
Diff:
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 8ddf5ba..b76a15d 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1182,7 +1182,11 @@ PHPAPI PHP_FUNCTION(fwrite)
if (ZEND_NUM_ARGS() == 2) {
num_bytes = arg2len;
} else {
- num_bytes = MAX(0, MIN((zend_str_size)arg3, arg2len));
+ if (arg3 > 0) {
+ num_bytes = MAX(0, MIN((zend_str_size)arg3, arg2len));
+ } else {
+ num_bytes = 0;
+ }
}
if (!num_bytes) {