]> granicus.if.org Git - php/commitdiff
- Fix build, thanks Christian Rodriguez for noticing
authorMarcus Boerger <helly@php.net>
Fri, 1 Feb 2008 23:46:36 +0000 (23:46 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 1 Feb 2008 23:46:36 +0000 (23:46 +0000)
# I wonder why the other machine didn't catch this

ext/spl/php_spl.c

index ca7da0df69810258418bb446c2621fa4158c9464..93eaa03a991f61a8cc5426da6f7d87530c107a42 100755 (executable)
@@ -395,7 +395,7 @@ PHP_FUNCTION(spl_autoload_call)
  Register given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_register)
 {
-       char *func_name;
+       char *func_name, *error = NULL;
        int  func_name_len;
        char *lc_name = NULL;
        zval *zcallable = NULL;
@@ -420,34 +420,49 @@ PHP_FUNCTION(spl_autoload_register)
                        }
                }
        
-               if (!zend_is_callable_ex(zcallable, IS_CALLABLE_STRICT, &func_name, &func_name_len, &alfi.ce, &alfi.func_ptr, &obj_ptr TSRMLS_CC)) {
+               if (!zend_is_callable_ex(zcallable, IS_CALLABLE_STRICT, &func_name, &func_name_len, &alfi.ce, &alfi.func_ptr, &obj_ptr, &error TSRMLS_CC)) {
                        if (Z_TYPE_P(zcallable) == IS_ARRAY) {
                                if (!obj_ptr && alfi.func_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) {
                                        if (do_throw) {
-                                               zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object");
+                                               zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array specifies a non static method but no object (%s)", error);
+                                       }
+                                       if (error) {
+                                               efree(error);
                                        }
                                        efree(func_name);
                                        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 " : "");
+                                       zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Passed array does not specify %s %smethod, (%s)", alfi.func_ptr ? "a callable" : "an existing", !obj_ptr ? "static " : "", error);
+                               }
+                               if (error) {
+                                       efree(error);
                                }
                                efree(func_name);
                                RETURN_FALSE;
                        } else if (Z_TYPE_P(zcallable) == IS_STRING) {
                                if (do_throw) {
-                                       zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%s' not %s", func_name, alfi.func_ptr ? "callable" : "found");
+                                       zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Function '%s' not %s (%s)", func_name, alfi.func_ptr ? "callable" : "found", error);
+                               }
+                               if (error) {
+                                       efree(error);
                                }
                                efree(func_name);
                                RETURN_FALSE;
                        } else {
                                if (do_throw) {
-                                       zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Illegal value passed");
+                                       zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Illegal value passed (%s)", error);
+                               }
+                               if (error) {
+                                       efree(error);
                                }
                                efree(func_name);
                                RETURN_FALSE;
                        }
                }
+               if (error) {
+                       efree(error);
+               }
        
                lc_name = safe_emalloc(func_name_len, 1, sizeof(long) + 1);
                zend_str_tolower_copy(lc_name, func_name, func_name_len);
@@ -501,7 +516,7 @@ skip:
  Unregister given function as __autoload() implementation */
 PHP_FUNCTION(spl_autoload_unregister)
 {
-       char *func_name;
+       char *func_name, *error = NULL;
        int func_name_len;
        zval *zcallable;
        int success = FAILURE;
@@ -512,7 +527,11 @@ PHP_FUNCTION(spl_autoload_unregister)
                return;
        }
 
-       if (!zend_is_callable_ex(zcallable, IS_CALLABLE_CHECK_SYNTAX_ONLY, &func_name, &func_name_len, NULL, NULL, &obj_ptr TSRMLS_CC)) {
+       if (!zend_is_callable_ex(zcallable, IS_CALLABLE_CHECK_SYNTAX_ONLY, &func_name, &func_name_len, NULL, NULL, &obj_ptr, &error TSRMLS_CC)) {
+               zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Unable to unregister invalid function (%s)", error);
+               if (error) {
+                       efree(error);
+               }
                if (func_name) {
                        efree(func_name);
                }