From cf6711abfa62cf3494eb9bafa2632b28d438b689 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Mon, 7 Mar 2005 21:54:08 +0000 Subject: [PATCH] - Length needs to be positive --- ext/standard/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index a64242ec1c..7d8fd5ceac 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1229,7 +1229,7 @@ PHPAPI PHP_FUNCTION(fwrite) } convert_to_string_ex(arg2); convert_to_long_ex(arg3); - num_bytes = MIN(Z_LVAL_PP(arg3), Z_STRLEN_PP(arg2)); + num_bytes = MAX(0, MIN(Z_LVAL_PP(arg3), Z_STRLEN_PP(arg2))); break; default: -- 2.50.1