pollita         Tue Mar 16 19:08:23 2004 EDT

  Modified files:              
    /php-src/main/streams       userspace.c 
  Log:
  Provide a meaningful error message when registration fails
  
http://cvs.php.net/diff.php/php-src/main/streams/userspace.c?r1=1.22&r2=1.23&ty=u
Index: php-src/main/streams/userspace.c
diff -u php-src/main/streams/userspace.c:1.22 php-src/main/streams/userspace.c:1.23
--- php-src/main/streams/userspace.c:1.22       Mon Mar  8 18:11:45 2004
+++ php-src/main/streams/userspace.c    Tue Mar 16 19:08:22 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: userspace.c,v 1.22 2004/03/08 23:11:45 abies Exp $ */
+/* $Id: userspace.c,v 1.23 2004/03/17 00:08:22 pollita Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -421,10 +421,17 @@
                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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to