diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index f9ddaa98b8ba0..8987e88b15dbc 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -213,25 +213,33 @@ static ZEND_INI_MH(OnEnable) stage == ZEND_INI_STAGE_DEACTIVATE) { return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } else { - /* It may be only temporary disabled */ - zend_bool *p; + /* It may be only temporary disabled */ + zend_bool *p; #ifndef ZTS - char *base = (char *) mh_arg2; + char *base = (char *) mh_arg2; #else - char *base = (char *) ts_resource(*((int *) mh_arg2)); + char *base = (char *) ts_resource(*((int *) mh_arg2)); #endif - p = (zend_bool *) (base+(size_t) mh_arg1); - if ((new_value_length == 2 && strcasecmp("on", new_value) == 0) || - (new_value_length == 3 && strcasecmp("yes", new_value) == 0) || - (new_value_length == 4 && strcasecmp("true", new_value) == 0) || - atoi(new_value) != 0) { - zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)"); - return FAILURE; - } else { - *p = 0; - return SUCCESS; - } + p = (zend_bool *) (base+(size_t) mh_arg1); + + if (!ZCG(enabled)) { + if ((new_value_length == 2 && strcasecmp("on", new_value) == 0) || + (new_value_length == 3 && strcasecmp("yes", new_value) == 0) || + (new_value_length == 4 && strcasecmp("true", new_value) == 0) || + atoi(new_value) != 0) { + zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " can't be temporary enabled (it may be only disabled till the end of request)"); + return FAILURE; + } + } else { + if ((new_value_length == 3 && strcasecmp("off", new_value) == 0) || + (new_value_length == 2 && strcasecmp("no", new_value) == 0) || + (new_value_length == 5 && strcasecmp("false", new_value) == 0) || + atoi(new_value) != 1) { + *p = 0; + } + return SUCCESS; + } } }