diff options
-rw-r--r-- | ext/standard/file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 138b723fd4..b6d3779d06 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -476,6 +476,10 @@ PHP_FUNCTION(file_set_contents) stream = php_stream_open_wrapper(filename, "wb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); + if (stream == NULL) { + RETURN_FALSE; + } + if (data_len) { numbytes = php_stream_write(stream, data, data_len); if (numbytes < 0) { |