summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-08-03 14:49:11 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-08-03 14:49:11 +0000
commit499ca0047631e2378c715ec38befab1463002df6 (patch)
treef446594eada378e3be4915ee1beed1ac4d2c12bd
parent5cff1c6e7e83cad9c3d2b4ec68777e585c4baa4b (diff)
downloadphp-git-499ca0047631e2378c715ec38befab1463002df6.tar.gz
Fixed bug #38303 (spl_autoload_register() supress all errors silently).
-rw-r--r--NEWS2
-rwxr-xr-xext/spl/php_spl.c28
2 files changed, 19 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index 4c411c6c0b..d4a60e7d98 100644
--- 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
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index f22a30c498..a0c53310c0 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -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;