From: Sara Golemon Date: Wed, 17 Mar 2004 00:08:22 +0000 (+0000) Subject: Provide a meaningful error message when registration fails X-Git-Tag: php-5.0.0RC1RC2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=581948ab00edfe528ea773920dddfc687af2c208;p=php Provide a meaningful error message when registration fails --- 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);