diff options
Diffstat (limited to 'main/streams/userspace.c')
| -rw-r--r-- | main/streams/userspace.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c index dc99c5c66..6bf110abc 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | + | Copyright (c) 1997-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: userspace.c,v 1.31.2.3.2.1 2006/08/14 15:01:29 tony2001 Exp $ */ +/* $Id: userspace.c,v 1.31.2.3.2.4 2007/02/13 19:50:59 tony2001 Exp $ */ #include "php.h" #include "php_globals.h" @@ -455,7 +455,7 @@ PHP_FUNCTION(stream_wrapper_register) RETURN_TRUE; } else { /* We failed. But why? */ - if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len)) { + if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len + 1)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol %s:// is already defined.", protocol); } else { /* Should never happen */ @@ -511,7 +511,7 @@ PHP_FUNCTION(stream_wrapper_restore) RETURN_TRUE; } - if ((zend_hash_find(global_wrapper_hash, protocol, protocol_len, (void**)&wrapperpp) == FAILURE) || !wrapperpp) { + if ((zend_hash_find(global_wrapper_hash, protocol, protocol_len + 1, (void**)&wrapperpp) == FAILURE) || !wrapperpp) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s:// never existed, nothing to restore", protocol); RETURN_FALSE; } @@ -759,6 +759,10 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o retval = NULL; } + if (ret) { + return ret; + } + /* now determine where we are */ ZVAL_STRINGL(&func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0); @@ -768,16 +772,20 @@ static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, o &retval, 0, NULL, 0, NULL TSRMLS_CC); - if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_LONG) + if (call_result == SUCCESS && retval != NULL && Z_TYPE_P(retval) == IS_LONG) { *newoffs = Z_LVAL_P(retval); - else - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", - us->wrapper->classname); + ret = 0; + } else if (call_result == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_TELL " is not implemented!", us->wrapper->classname); + ret = -1; + } else { + ret = -1; + } - if (retval) + if (retval) { zval_ptr_dtor(&retval); - - return 0; + } + return ret; } /* parse the return value from one of the stat functions and store the |
