zeev Sun Nov 17 08:26:37 2002 EDT Modified files: /Zend zend.c zend.h zend_builtin_functions.c zend_execute.c zend_execute_API.c /php4/main main.c Log: Unify handling of error_reporting - fix bug #16137 Index: Zend/zend.c diff -u Zend/zend.c:1.162 Zend/zend.c:1.163 --- Zend/zend.c:1.162 Fri Nov 1 17:19:55 2002 +++ Zend/zend.c Sun Nov 17 08:26:36 2002 @@ -59,6 +59,22 @@ static int (*zend_get_configuration_directive_p)(char *name, uint name_length, zval *contents); +static ZEND_INI_MH(OnUpdateErrorReporting) +{ + if (!new_value) { + EG(error_reporting) = E_ALL & ~E_NOTICE; + } else { + EG(error_reporting) = atoi(new_value); + } + return SUCCESS; +} + + +ZEND_INI_BEGIN() + ZEND_INI_ENTRY("error_reporting", NULL, +ZEND_INI_ALL, OnUpdateErrorReporting) +ZEND_INI_END() + + #ifdef ZTS ZEND_API int compiler_globals_id; ZEND_API int executor_globals_id; @@ -487,6 +503,14 @@ #endif return SUCCESS; +} + + +void zend_register_standard_ini_entries(TSRMLS_D) +{ + int module_number = 0; + + REGISTER_INI_ENTRIES(); } Index: Zend/zend.h diff -u Zend/zend.h:1.165 Zend/zend.h:1.166 --- Zend/zend.h:1.165 Thu Nov 14 00:41:32 2002 +++ Zend/zend.h Sun Nov 17 08:26:36 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.165 2002/11/14 05:41:32 sebastian Exp $ */ +/* $Id: zend.h,v 1.166 2002/11/17 13:26:36 zeev Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -348,6 +348,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions); void zend_shutdown(TSRMLS_D); +void zend_register_standard_ini_entries(TSRMLS_D); #ifdef ZTS void zend_post_startup(TSRMLS_D); Index: Zend/zend_builtin_functions.c diff -u Zend/zend_builtin_functions.c:1.124 Zend/zend_builtin_functions.c:1.125 --- Zend/zend_builtin_functions.c:1.124 Mon Oct 21 04:42:32 2002 +++ Zend/zend_builtin_functions.c Sun Nov 17 08:26:37 2002 @@ -22,7 +22,7 @@ #include "zend_API.h" #include "zend_builtin_functions.h" #include "zend_constants.h" - +#include "zend_ini.h" #undef ZEND_TEST_EXCEPTIONS static ZEND_FUNCTION(zend_version); @@ -398,8 +398,8 @@ if (zend_get_parameters_ex(1, &arg) == FAILURE) { RETURN_FALSE; } - convert_to_long_ex(arg); - EG(error_reporting)=(*arg)->value.lval; + convert_to_string_ex(arg); + zend_alter_ini_entry("error_reporting", +sizeof("error_reporting"), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), ZEND_INI_USER, +ZEND_INI_STAGE_RUNTIME); break; default: ZEND_WRONG_PARAM_COUNT(); Index: Zend/zend_execute.c diff -u Zend/zend_execute.c:1.316 Zend/zend_execute.c:1.317 --- Zend/zend_execute.c:1.316 Mon Nov 11 13:27:32 2002 +++ Zend/zend_execute.c Sun Nov 17 08:26:37 2002 @@ -31,6 +31,7 @@ #include "zend_extensions.h" #include "zend_fast_cache.h" #include "zend_execute_locks.h" +#include "zend_ini.h" #define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free TSRMLS_CC) #define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts TSRMLS_CC) @@ -2424,10 +2425,16 @@ case ZEND_BEGIN_SILENCE: EX(Ts)[EX(opline)->result.u.var].tmp_var.value.lval = EG(error_reporting); EX(Ts)[EX(opline)->result.u.var].tmp_var.type = IS_LONG; /* shouldn't be necessary */ - EG(error_reporting) = 0; + zend_alter_ini_entry("error_reporting", +sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); NEXT_OPCODE(); - case ZEND_END_SILENCE: - EG(error_reporting) = EX(Ts)[EX(opline)->op1.u.var].tmp_var.value.lval; + case ZEND_END_SILENCE: { + zval restored_error_reporting; + + restored_error_reporting.type = IS_LONG; + restored_error_reporting.value.lval = +EX(Ts)[EX(opline)->op1.u.var].tmp_var.value.lval; + convert_to_string(&restored_error_reporting); + zend_alter_ini_entry("error_reporting", +sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), +Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + } NEXT_OPCODE(); case ZEND_QM_ASSIGN: { zval *value = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R); @@ -2438,7 +2445,7 @@ } } NEXT_OPCODE(); - case ZEND_EXT_STMT: + case ZEND_EXT_STMT: if (!EG(no_extensions)) { zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, op_array TSRMLS_CC); } Index: Zend/zend_execute_API.c diff -u Zend/zend_execute_API.c:1.155 Zend/zend_execute_API.c:1.156 --- Zend/zend_execute_API.c:1.155 Thu Oct 10 12:27:52 2002 +++ Zend/zend_execute_API.c Sun Nov 17 08:26:37 2002 @@ -160,8 +160,6 @@ zend_ptr_stack_init(&EG(user_error_handlers)); - EG(orig_error_reporting) = EG(error_reporting); - EG(full_tables_cleanup) = 0; #ifdef ZEND_WIN32 EG(timed_out) = 0; @@ -226,8 +224,6 @@ zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1); zend_ptr_stack_destroy(&EG(user_error_handlers)); - - EG(error_reporting) = EG(orig_error_reporting); } zend_end_try(); } Index: php4/main/main.c diff -u php4/main/main.c:1.512 php4/main/main.c:1.513 --- php4/main/main.c:1.512 Tue Nov 12 09:40:00 2002 +++ php4/main/main.c Sun Nov 17 08:26:37 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.512 2002/11/12 14:40:00 iliaa Exp $ */ +/* $Id: main.c,v 1.513 2002/11/17 13:26:37 zeev Exp $ */ /* {{{ includes */ @@ -162,18 +162,6 @@ /* }}} */ #endif -/* {{{ PHP_INI_MH - */ -static PHP_INI_MH(OnUpdateErrorReporting) -{ - if (!new_value) { - EG(error_reporting) = E_ALL & ~E_NOTICE; - } else { - EG(error_reporting) = atoi(new_value); - } - return SUCCESS; -} -/* }}} */ /* {{{ php_disable_functions */ @@ -307,7 +295,6 @@ PHP_INI_ENTRY("SMTP", "localhost",PHP_INI_ALL, NULL) PHP_INI_ENTRY("smtp_port", "25", PHP_INI_ALL, NULL) PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL) - PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting) #if MEMORY_LIMIT PHP_INI_ENTRY("memory_limit", "8M", PHP_INI_ALL, OnChangeMemoryLimit) #endif @@ -1085,6 +1072,7 @@ } REGISTER_INI_ENTRIES(); + zend_register_standard_ini_entries(TSRMLS_C); /* initialize stream wrappers registry * (this uses configuration parameters from php.ini)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php