com php-src: fixed fwrite: ext/standard/file.c
| From: | Anatol Belski | Date: | Wed, 16 Oct 2013 10:09:47 +0000 |
| Subject: | com php-src: fixed fwrite: ext/standard/file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73480@lists.php.net to get a copy of this message | ||
Commit: b7f87230652bf23c3676394f0ce3497e1f8fa703
Author: Anatol Belski <ab@php.net> Thu, 22 Aug 2013 00:54:45 -0700
Parents: a8959d76c893339a65fd720aaa7afba46278935d
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b7f87230652bf23c3676394f0ce3497e1f8fa703
Log:
fixed fwrite
Changed paths:
M ext/standard/file.c
Diff:
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 4defb6c..e3cee07 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) {