From: Sterling Hughes Date: Fri, 21 Mar 2003 22:22:15 +0000 (+0000) Subject: fix segfault in file_set_contents() when the file could not successfully X-Git-Tag: RELEASE_0_5~387 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a4282eabff64fd15a1fa3ad6f8dc04daedf4eca;p=php fix segfault in file_set_contents() when the file could not successfully be opened. --- 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) {