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

index 6fde9737ccd0d99f82e5335c02f972fcd8bf273a..0e952ca39268a87d2e34e8b9ec8bc953047e2d32 100755 (executable)
@@ -1809,13 +1809,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) {