helly Thu Mar 23 19:34:20 2006 UTC Modified files: /php-src/ext/spl php_spl.c Log: - Make spl_autoload_register() return bool http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.88&r2=1.89&diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.88 php-src/ext/spl/php_spl.c:1.89 --- php-src/ext/spl/php_spl.c:1.88 Thu Mar 23 12:55:58 2006 +++ php-src/ext/spl/php_spl.c Thu Mar 23 19:34:20 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_spl.c,v 1.88 2006/03/23 12:55:58 helly Exp $ */ +/* $Id: php_spl.c,v 1.89 2006/03/23 19:34:20 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -378,7 +378,7 @@ } } /* }}} */ -/* {{{ proto void spl_autoload_register([mixed autoload_function = "spl_autoload" [, throw = true]]) +/* {{{ proto bool spl_autoload_register([mixed autoload_function = "spl_autoload" [, throw = true]]) Register given function as __autoload() implementation */ PHP_FUNCTION(spl_autoload_register) { @@ -400,7 +400,7 @@ if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered"); } - return; + RETURN_FALSE; } } } else if (Z_TYPE_P(zcallable) == IS_UNICODE) { @@ -411,7 +411,7 @@ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function spl_autoload_call() cannot be registered"); } zval_dtor(&ztmp); - return; + RETURN_FALSE; } } zval_dtor(&ztmp); @@ -424,25 +424,25 @@ zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object"); } zval_dtor(&zfunc_name); - return; + RETURN_FALSE; } else if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : ""); } zval_dtor(&zfunc_name); - return; + RETURN_FALSE; } else if (Z_TYPE_P(zcallable) == IS_STRING || Z_TYPE_P(zcallable) == IS_UNICODE) { if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%R' not %s", Z_TYPE_P(zcallable), Z_UNIVAL_P(zcallable), alfi.func_ptr ? "callable" : "found"); } zval_dtor(&zfunc_name); - return; + RETURN_FALSE; } else { if (do_throw) { zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Illegal value passed"); } zval_dtor(&zfunc_name); - return; + RETURN_FALSE; } } @@ -480,6 +480,7 @@ } else { zend_hash_find(EG(function_table), "spl_autoload", sizeof("spl_autoload"), (void **) &EG(autoload_func)); } + RETURN_TRUE; } /* }}} */ /* {{{ proto bool spl_autoload_unregister(mixed autoload_function) @@ -498,7 +499,7 @@ if (!zend_is_callable_ex(zcallable, IS_CALLABLE_CHECK_SYNTAX_ONLY, &zfunc_name, NULL, NULL, NULL TSRMLS_CC)) { zval_dtor(&zfunc_name); - return; + RETURN_FALSE; } lc_name = zend_u_str_tolower_dup(Z_TYPE(zfunc_name), Z_UNIVAL(zfunc_name), Z_UNILEN(zfunc_name));
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php