]> granicus.if.org Git - php/commitdiff
MFH: fix #36359 (splFileObject::fwrite() doesn't write when no data length specified)
authorAntony Dovgal <tony2001@php.net>
Fri, 10 Feb 2006 16:57:56 +0000 (16:57 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 10 Feb 2006 16:57:56 +0000 (16:57 +0000)
NEWS
ext/spl/spl_directory.c

diff --git a/NEWS b/NEWS
index 7cd8fc3d7fcd7ab61d497c7e2604ff0c9ebd834d..a944d1529b7f252599a65dd58a4fd73bbe2ebada 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ PHP                                                                        NEWS
 - Added imap_savebody() that allows message body to be written to a file. (Mike)
 - Fixed imagecolorallocate() and imagecolorallocatelapha() to return FALSE
   on error. (Pierre)
+- Fixed bug #36359 (splFileObject::fwrite() doesn't write when no data length 
+  specified). (Tony)
 - Fixed bug #36334 (Added missing documentation about realpath cache INI 
   settings). (Ilia)
 - Fixed bug #36308 (ReflectionProperty::getDocComment() does not reflect 
index 8517cacb6312340e3d3713eb6eda1d042f994212..51084d55dc27ae7f6698458cac92b72532e4c408 100755 (executable)
@@ -1801,13 +1801,13 @@ SPL_METHOD(SplFileObject, fwrite)
        char *str;
        int str_len;
        int ret;
-       long length;
+       long length = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) {
                return;
        }
 
-       if (ZEND_NUM_ARGS() < 2) {
+       if (ZEND_NUM_ARGS() > 1) {
                str_len = MAX(0, MIN(length, str_len));
        }
        if (!str_len) {