diff options
| author | jvoisin | 2020-11-18 20:13:12 +0100 |
|---|---|---|
| committer | jvoisin | 2020-11-18 20:14:27 +0100 |
| commit | e134c87a9a7850d1db30cfe10eb0f521b27953a5 (patch) | |
| tree | 0b00105b0d40db94cc8fe984635e8393d2133e01 /src | |
| parent | 3c3048032fb0a79d04765d2b4f064f012208ced8 (diff) | |
Make the strict mode disableable
The global strict mode was enabled by default without
any means to disable it, in certain cases.
Bug reported by wedi.
Diffstat (limited to 'src')
| -rw-r--r-- | src/snuffleupagus.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index 7c69150..9a5ac90 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c | |||
| @@ -22,10 +22,13 @@ ZEND_DLEXPORT int sp_zend_startup(zend_extension *extension) { | |||
| 22 | // LCOV_EXCL_END | 22 | // LCOV_EXCL_END |
| 23 | 23 | ||
| 24 | static inline void sp_op_array_handler(zend_op_array *op) { | 24 | static inline void sp_op_array_handler(zend_op_array *op) { |
| 25 | if (NULL == op->filename) { | 25 | // We need a filename, and strict mode not already enabled on this op |
| 26 | if (NULL == op->filename || op->fn_flags & ZEND_ACC_STRICT_TYPES) { | ||
| 26 | return; | 27 | return; |
| 27 | } else { | 28 | } else { |
| 28 | op->fn_flags |= ZEND_ACC_STRICT_TYPES; | 29 | if (true == SNUFFLEUPAGUS_G(config).config_global_strict->enable) { |
| 30 | op->fn_flags |= ZEND_ACC_STRICT_TYPES; | ||
| 31 | } | ||
| 29 | } | 32 | } |
| 30 | } | 33 | } |
| 31 | 34 | ||
| @@ -59,7 +62,7 @@ ZEND_DLEXPORT zend_extension zend_extension_entry = { | |||
| 59 | NULL, /* activate_func_t */ | 62 | NULL, /* activate_func_t */ |
| 60 | NULL, /* deactivate_func_t */ | 63 | NULL, /* deactivate_func_t */ |
| 61 | NULL, /* message_handler_func_t */ | 64 | NULL, /* message_handler_func_t */ |
| 62 | sp_op_array_handler, // zend_global_strict, /* op_array_handler_func_t */ | 65 | sp_op_array_handler, /* op_array_handler_func_t */ |
| 63 | NULL, /* statement_handler_func_t */ | 66 | NULL, /* statement_handler_func_t */ |
| 64 | NULL, /* fcall_begin_handler_func_t */ | 67 | NULL, /* fcall_begin_handler_func_t */ |
| 65 | NULL, /* fcall_end_handler_func_t */ | 68 | NULL, /* fcall_end_handler_func_t */ |
| @@ -222,7 +225,7 @@ PHP_MINFO_FUNCTION(snuffleupagus) { | |||
| 222 | case SP_CONFIG_INVALID: | 225 | case SP_CONFIG_INVALID: |
| 223 | valid_config = "invalid"; | 226 | valid_config = "invalid"; |
| 224 | break; | 227 | break; |
| 225 | case SP_CONFIG_NONE: | 228 | case SP_CONFIG_NONE: |
| 226 | default: | 229 | default: |
| 227 | valid_config = "no"; | 230 | valid_config = "no"; |
| 228 | } | 231 | } |
