summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2004-03-17 00:08:22 +0000
committerSara Golemon <pollita@php.net>2004-03-17 00:08:22 +0000
commit581948ab00edfe528ea773920dddfc687af2c208 (patch)
tree3d62f5ead21d5828485fe67fd888d99ac5d46cfe
parent88058e57155703718c6f33c468beccfe45f75945 (diff)
downloadphp-git-581948ab00edfe528ea773920dddfc687af2c208.tar.gz
Provide a meaningful error message when registration fails
-rw-r--r--main/streams/userspace.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index cf1c4d4c1e..5ed06d344b 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -421,10 +421,17 @@ PHP_FUNCTION(stream_wrapper_register)
uwrap->ce = *(zend_class_entry**)uwrap->ce;
if (php_register_url_stream_wrapper(protocol, &uwrap->wrapper TSRMLS_CC) == SUCCESS) {
RETURN_TRUE;
+ } else {
+ /* We failed. But why? */
+ if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol %s:// is already defined.", protocol);
+ } else {
+ /* Should never happen */
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to register wrapper class %s to %s://", classname, protocol);
+ }
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "class '%s' is undefined",
- classname);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "class '%s' is undefined", classname);
}
zend_list_delete(rsrc_id);