helly           Fri Feb  1 23:46:36 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/spl    php_spl.c 
  Log:
  - Fix build, thanks Christian Rodriguez for noticing
  # I wonder why the other machine didn't catch this
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/php_spl.c?r1=1.52.2.28.2.17.2.9&r2=1.52.2.28.2.17.2.10&diff_format=u
Index: php-src/ext/spl/php_spl.c
diff -u php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.9 
php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.10
--- php-src/ext/spl/php_spl.c:1.52.2.28.2.17.2.9        Sun Jan 27 15:04:41 2008
+++ php-src/ext/spl/php_spl.c   Fri Feb  1 23:46:36 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_spl.c,v 1.52.2.28.2.17.2.9 2008/01/27 15:04:41 helly Exp $ */
+/* $Id: php_spl.c,v 1.52.2.28.2.17.2.10 2008/02/01 23:46:36 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -395,7 +395,7 @@
  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 @@
                        }
                }
        
-               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 @@
  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 @@
                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);
                }

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

Reply via email to