]> granicus.if.org Git - php/commitdiff
Fixed bug #38303 (spl_autoload_register() supress all errors silently).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 3 Aug 2006 14:49:11 +0000 (14:49 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 3 Aug 2006 14:49:11 +0000 (14:49 +0000)
NEWS
ext/spl/php_spl.c

diff --git a/NEWS b/NEWS
index 4c411c6c0bc08f7e60e2cd9850a59d3f0eaf5196..d4a60e7d988f4e79ce8acf9f4cb2f3f393b807b6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,8 @@ PHP                                                                        NEWS
 - Fixed phpinfo() cutoff of variables at \0. (Ilia)
 - Fixed a bug in the filter extension that prevented magic_quotes_gpc from
   being applied when RAW filter is used. (Ilia)
+- Fixed bug #38303 (spl_autoload_register() supress all errors silently).
+  (Ilia)
 - Fixed bug #38289 (segfault in session_decode() when _SESSION is NULL). 
   (Tony)
 - Fixed bug #38278 (session_cache_expire()'s value does not match phpinfo's 
index f22a30c498a8941254da9da8cf570c5e24d8899f..a0c53310c0bb4cab6245e1f3a974f329d17f7b47 100755 (executable)
@@ -213,10 +213,25 @@ int spl_autoload(const char *class_name, const char * lc_name, int class_name_le
        zend_file_handle file_handle;
        zend_op_array *new_op_array;
        zval *result = NULL;
+       zval err_mode;
+       int ret;
 
        class_file_len = spprintf(&class_file, 0, "%s%s", lc_name, file_extension);
 
-       if (zend_stream_open(class_file, &file_handle TSRMLS_CC) == SUCCESS) {
+       ZVAL_LONG(&err_mode, EG(error_reporting));
+       if (Z_LVAL(err_mode)) {
+               php_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+       }
+
+       ret = zend_stream_open(class_file, &file_handle TSRMLS_CC);
+
+       if (!EG(error_reporting) && Z_LVAL(err_mode) != EG(error_reporting)) {
+               convert_to_string(&err_mode);
+               zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(err_mode), Z_STRLEN(err_mode), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+               zendi_zval_dtor(err_mode);
+       }
+
+       if (ret == SUCCESS) {
                if (!file_handle.opened_path) {
                        file_handle.opened_path = estrndup(class_file, class_file_len);
                }
@@ -230,7 +245,7 @@ int spl_autoload(const char *class_name, const char * lc_name, int class_name_le
                if (new_op_array) {
                        EG(return_value_ptr_ptr) = &result;
                        EG(active_op_array) = new_op_array;
-       
+
                        zend_execute(new_op_array TSRMLS_CC);
        
                        destroy_op_array(new_op_array TSRMLS_CC);
@@ -266,9 +281,6 @@ PHP_FUNCTION(spl_autoload)
                RETURN_FALSE;
        }
 
-       ZVAL_LONG(&err_mode, EG(error_reporting));
-       php_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); 
-
        copy = pos1 = estrdup(ZEND_NUM_ARGS() > 1 ? file_exts : SPL_G(autoload_extensions));
        lc_name = zend_str_tolower_dup(class_name, class_name_len);
        while(pos1 && *pos1 && !EG(exception)) {
@@ -289,12 +301,6 @@ PHP_FUNCTION(spl_autoload)
                efree(copy);
        }
 
-       if (!EG(error_reporting) && Z_LVAL(err_mode) != EG(error_reporting)) {
-               convert_to_string(&err_mode);
-               zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(err_mode), Z_STRLEN(err_mode), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
-               zendi_zval_dtor(err_mode);
-       }
-
        EG(return_value_ptr_ptr) = original_return_value;
        EG(opline_ptr) = original_opline_ptr;
        EG(active_op_array) = original_active_op_array;