From: Antony Dovgal Date: Fri, 10 Feb 2006 16:57:56 +0000 (+0000) Subject: MFH: fix #36359 (splFileObject::fwrite() doesn't write when no data length specified) X-Git-Tag: php-5.1.3RC1~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08c4c9c2028f8012542b7c9d595ff0f1a338221e;p=php MFH: fix #36359 (splFileObject::fwrite() doesn't write when no data length specified) --- diff --git a/NEWS b/NEWS index 7cd8fc3d7f..a944d1529b 100644 --- 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 diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 8517cacb63..51084d55dc 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -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) {