summaryrefslogtreecommitdiff
path: root/main/streams/userspace.c
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:28 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:28 -0400
commitba50031707469046407a35b77a3cd81351e951b3 (patch)
tree5c03e723bdbfabae09d41a3ab1253dff41eeed4a /main/streams/userspace.c
parent0a36161e13484a99ccf69bb38f206462d27cc6d6 (diff)
downloadphp-upstream/5.1.5.tar.gz
Imported Upstream version 5.1.5upstream/5.1.5
Diffstat (limited to 'main/streams/userspace.c')
-rw-r--r--main/streams/userspace.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index d1e3edc1b..e9447a05a 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: userspace.c,v 1.31.2.2 2006/01/01 12:50:18 sniper Exp $ */
+/* $Id: userspace.c,v 1.31.2.3 2006/04/22 17:17:40 wez Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -464,7 +464,7 @@ PHP_FUNCTION(stream_wrapper_restore)
{
char *protocol;
int protocol_len;
- php_stream_wrapper *wrapper = NULL;
+ php_stream_wrapper **wrapperpp = NULL, *wrapper;
HashTable *global_wrapper_hash;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &protocol, &protocol_len) == FAILURE) {
@@ -477,11 +477,14 @@ PHP_FUNCTION(stream_wrapper_restore)
RETURN_TRUE;
}
- if ((zend_hash_find(global_wrapper_hash, protocol, protocol_len, (void**)&wrapper) == FAILURE) || !wrapper) {
+ if ((zend_hash_find(global_wrapper_hash, protocol, protocol_len, (void**)&wrapperpp) == FAILURE) || !wrapperpp) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// never existed, nothing to restore", protocol);
RETURN_FALSE;
}
+ /* next line might delete the pointer that wrapperpp points at, so deref it now */
+ wrapper = *wrapperpp;
+
/* A failure here could be okay given that the protocol might have been merely unregistered */
php_unregister_url_stream_wrapper_volatile(protocol TSRMLS_CC);