From c484eb8c97b084b09e7368e0ac0947c0c4f4f46f Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 26 Sep 2002 12:12:27 +0000 Subject: Fix segfault in wrapper error log mechanism when errors are logged on second and subsequent events. Implement very simple recursion protection for user streams written like this: class urlEncodeStream { var $fp = NULL; function stream_open($path, $mode, $options, &$opened_path) { $this->fp = fopen($path, $mode); // <-- this recurses infinitely return is_resource($this->fp); } } file_register_wrapper('urlencode', 'urlEncodeStream'); $fp = fopen('urlencode:///tmp/outputfile.txt', 'w'); Noticed by: Yasuo. --- ext/standard/file.h | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/standard/file.h') diff --git a/ext/standard/file.h b/ext/standard/file.h index 3990504509..4e5eba55dd 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -115,6 +115,7 @@ typedef struct { int auto_detect_line_endings; int default_socket_timeout; char *user_agent; + char *user_stream_current_filename; /* for simple recursion protection */ } php_file_globals; #ifdef ZTS -- cgit v1.2.1