php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #74337
Patch php_stream_fopen_tmpfile revision 2017-04-13 13:30 UTC by aserbulov at plesk dot com

Patch php_stream_fopen_tmpfile for *General Issues Bug #74337

Patch version 2017-04-13 13:30 UTC

Return to Bug #74337 | Download this patch
Patch Revisions:

Developer: aserbulov@plesk.com

 main/streams/memory.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/main/streams/memory.c b/main/streams/memory.c
index 253d1d8..07bcc53 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -489,9 +489,14 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret)
 		return FAILURE;
 	}
 
+	file = php_stream_fopen_tmpfile();
+	if (file == NULL) {
+		php_error_docref(NULL, E_WARNING, "Unable to create temporary file, Check permissions in temporary files directory.");
+		return FAILURE;
+	}
+
 	/* perform the conversion and then pass the request on to the innerstream */
 	membuf = php_stream_memory_get_buffer(ts->innerstream, &memsize);
-	file = php_stream_fopen_tmpfile();
 	php_stream_write(file, membuf, memsize);
 	pos = php_stream_tell(ts->innerstream);
 
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Oct 19 02:01:25 2018 UTC