diff options
author | Antony Dovgal <tony2001@php.net> | 2006-02-10 16:57:56 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-02-10 16:57:56 +0000 |
commit | 08c4c9c2028f8012542b7c9d595ff0f1a338221e (patch) | |
tree | e7880a2d5cf0bf1e271d3a0228fa3ceb93684925 | |
parent | 6cc9f92d161b84ff62d0ab6284ca47eafca2996f (diff) | |
download | php-git-08c4c9c2028f8012542b7c9d595ff0f1a338221e.tar.gz |
MFH: fix #36359 (splFileObject::fwrite() doesn't write when no data length specified)
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | ext/spl/spl_directory.c | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -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) { |