diff options
| author | Sara Golemon <pollita@php.net> | 2004-06-21 18:58:55 +0000 |
|---|---|---|
| committer | Sara Golemon <pollita@php.net> | 2004-06-21 18:58:55 +0000 |
| commit | 7fcfa8865e97a6c8141532187428d9dd9d1217e5 (patch) | |
| tree | c5686f91dea2654cd3bad7d90bf36ae2f5decc5a /ext/standard | |
| parent | d9226a1dd0e0644334adecbfa9ab4b76969610fa (diff) | |
| download | php-git-7fcfa8865e97a6c8141532187428d9dd9d1217e5.tar.gz | |
BugFix#28868: Wrapper hash not thread-safe.
Userdefined wrappers were being registered into a global wrapper hash
which can cross threads. Termination of once instance then has the
potential to leave an active stream in another instance with no wrapper
leading to segfault.
Diffstat (limited to 'ext/standard')
| -rw-r--r-- | ext/standard/basic_functions.c | 9 | ||||
| -rw-r--r-- | ext/standard/file.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9b61526537..970c962848 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1160,6 +1160,9 @@ PHP_RINIT_FUNCTION(basic) /* Setup default context */ FG(default_context) = NULL; + /* Default to global wrappers only */ + FG(stream_wrappers) = NULL; + return SUCCESS; } @@ -1197,6 +1200,12 @@ PHP_RSHUTDOWN_FUNCTION(basic) BG(user_tick_functions) = NULL; } + if (FG(stream_wrappers)) { + zend_hash_destroy(FG(stream_wrappers)); + efree(FG(stream_wrappers)); + FG(stream_wrappers) = NULL; + } + PHP_RSHUTDOWN(user_filters)(SHUTDOWN_FUNC_ARGS_PASSTHRU); return SUCCESS; diff --git a/ext/standard/file.h b/ext/standard/file.h index 55d3660012..aba42e01bb 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -113,6 +113,7 @@ typedef struct { char *user_agent; char *user_stream_current_filename; /* for simple recursion protection */ php_stream_context *default_context; + HashTable *stream_wrappers; /* per-request copy of url_stream_wrappers_hash */ } php_file_globals; #ifdef ZTS |
