From: Ilia Alshanetsky Date: Sun, 30 Mar 2008 15:06:07 +0000 (+0000) Subject: MFB: Added a warning message X-Git-Tag: RELEASE_2_0_0b1~530 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c22a23ccd5b9fd1080b937145128caf6a9ec9261;p=php MFB: Added a warning message --- diff --git a/ext/standard/file.c b/ext/standard/file.c index 26d14ddc74..054697cc07 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -624,6 +624,7 @@ PHP_FUNCTION(file_put_contents) php_stream_context *context = NULL; char mode[3] = { 'w', 0, 0 }; php_stream *srcstream = NULL; + char mode[3] = "wb"; if (zend_parse_parameters(argc TSRMLS_CC, "Zz/|lr!", &ppfilename, &data, &flags, &zcontext) == FAILURE) { return; @@ -655,9 +656,14 @@ PHP_FUNCTION(file_put_contents) if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) { php_stream_close(stream); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Exclusive locks are not supported for this stream"); RETURN_FALSE; } + if (mode[0] = 'c') { + php_stream_truncate_set_size(stream, 0); + } + switch (Z_TYPE_P(data)) { case IS_RESOURCE: numchars = php_stream_copy_to_stream(srcstream, stream, PHP_STREAM_COPY_ALL);