]> granicus.if.org Git - php/commitdiff
MFZE1 - error_reporting fix
authorZeev Suraski <zeev@php.net>
Tue, 19 Nov 2002 17:51:30 +0000 (17:51 +0000)
committerZeev Suraski <zeev@php.net>
Tue, 19 Nov 2002 17:51:30 +0000 (17:51 +0000)
Zend/zend.c
Zend/zend.h
Zend/zend_builtin_functions.c
Zend/zend_execute.c
Zend/zend_execute_API.c

index 3901a464579380adb36a10f30f135b0226d28703..80c1b824a49bf3ca50abf3c81866292b3cb0463b 100644 (file)
@@ -58,6 +58,22 @@ static void (*zend_message_dispatcher_p)(long message, void *data);
 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;
@@ -508,6 +524,14 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i
 }
 
 
+void zend_register_standard_ini_entries(TSRMLS_D)
+{
+       int module_number = 0;
+
+       REGISTER_INI_ENTRIES();
+}
+
+
 #ifdef ZTS
 /* Unlink the global (r/o) copies of the class, function and constant tables,
  * and use a fresh r/w copy for the startup thread
index e36ce7db0f3b0d2fc576c6e44cf040aeba3cd89a..de97d15db33a17696601f0230d23242c4f561489 100644 (file)
@@ -396,6 +396,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length);
 
 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 dd423366f1a99b90531ae76f3ec5f4602592c26c..3c09474391fe5de6c2c82579a694209fbc3d11a5 100644 (file)
@@ -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);
@@ -408,8 +408,8 @@ ZEND_FUNCTION(error_reporting)
                        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 19a06deb01246df7eabd8c49b2f641ba8e07bb6d..a50ce095a243ce7fe6adba4c151d95d698a54fca 100644 (file)
@@ -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)
@@ -3566,16 +3567,21 @@ int zend_exit_handler(ZEND_OPCODE_HANDLER_ARGS)
 
 int zend_begin_silence_handler(ZEND_OPCODE_HANDLER_ARGS)
 {
-       EX_T(EX(opline)->result.u.var).tmp_var.value.lval = EG(error_reporting);
-       EX_T(EX(opline)->result.u.var).tmp_var.type = IS_LONG;  /* shouldn't be necessary */
-       EG(error_reporting) = 0;
+       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 */
+       zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
        NEXT_OPCODE();
 }
 
 int zend_end_silence_handler(ZEND_OPCODE_HANDLER_ARGS)
 {
-       EG(error_reporting) = EX_T(EX(opline)->op1.u.var).tmp_var.value.lval;
-       NEXT_OPCODE();
+       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);
+       zendi_zval_dtor(restored_error_reporting);
 }
 
 int zend_qm_assign_handler(ZEND_OPCODE_HANDLER_ARGS)
index 8814964269cbee107609419338a8ab5ca697f541..933751168f8475fc6490fc0104e5f4466aba69da 100644 (file)
@@ -162,7 +162,6 @@ void init_executor(TSRMLS_D)
        zend_ptr_stack_init(&EG(user_error_handlers));
        zend_ptr_stack_init(&EG(user_exception_handlers));
 
-       EG(orig_error_reporting) = EG(error_reporting);
        zend_objects_store_init(&EG(objects_store), 1024);
 
        EG(full_tables_cleanup) = 0;
@@ -251,7 +250,6 @@ void shutdown_executor(TSRMLS_D)
                zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
                zend_ptr_stack_destroy(&EG(user_exception_handlers));
 
-               EG(error_reporting) = EG(orig_error_reporting);
                zend_objects_store_destroy(&EG(objects_store));
        } zend_end_try();
 }