From 1a5d6acff63c75b1fb933d4a7b32d073722cb6c5 Mon Sep 17 00:00:00 2001 From: Joe Watkins Date: Sun, 20 Sep 2015 06:23:36 +0100 Subject: [PATCH] ZEND_COMPILE_GUARDS compiler option --- Zend/zend_compile.c | 4 ++++ Zend/zend_compile.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1323dbc778..2e98f10c6a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1608,6 +1608,10 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify ce->refcount = 1; ce->ce_flags = ZEND_ACC_CONSTANTS_UPDATED; + if (CG(compiler_options) & ZEND_COMPILE_GUARDS) { + ce->ce_flags |= ZEND_ACC_USE_GUARDS; + } + ce->default_properties_table = NULL; ce->default_static_members_table = NULL; zend_hash_init_ex(&ce->properties_info, 8, NULL, (persistent_hashes ? zend_destroy_property_info_internal : NULL), persistent_hashes, 0); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index dae8d173a0..06c7d02149 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -1005,6 +1005,9 @@ END_EXTERN_C() /* generate ZEND_INIT_FCALL_BY_NAME for userland functions instead of ZEND_INIT_FCALL */ #define ZEND_COMPILE_IGNORE_USER_FUNCTIONS (1<<8) +/* force IS_OBJ_USE_GUARDS for all classes */ +#define ZEND_COMPILE_GUARDS (1<<9) + /* The default value for CG(compiler_options) */ #define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY -- 2.49.0