From 625acc345070758e70e9b9f6bd6c49156d1ac637 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 12 Aug 2013 16:51:00 +0100 Subject: [PATCH 1/7] fix strangeness for pthreads --- ext/opcache/zend_accelerator_module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index f9ddaa98b8ba0..81dc9ec918db4 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -212,7 +212,7 @@ static ZEND_INI_MH(OnEnable) stage == ZEND_INI_STAGE_SHUTDOWN || stage == ZEND_INI_STAGE_DEACTIVATE) { return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - } else { + } else if (!ZCG(enabled)) { /* It may be only temporary disabled */ zend_bool *p; #ifndef ZTS @@ -232,6 +232,8 @@ static ZEND_INI_MH(OnEnable) *p = 0; return SUCCESS; } + } else { + return SUCCESS; } } From b3c9d48a6e50a12ca082e10e0236fa0f28c7b0b3 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 19 Aug 2013 06:04:46 +0100 Subject: [PATCH 2/7] fix logic in ini mh for enabled --- ext/opcache/zend_accelerator_module.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 81dc9ec918db4..80bc3f10da960 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -228,11 +228,9 @@ static ZEND_INI_MH(OnEnable) 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; } } else { + *p = 0; return SUCCESS; } } From d841f11b0f75f7a9cdcdd5d557c43eb92c8e254b Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 19 Aug 2013 07:08:18 +0100 Subject: [PATCH 3/7] fffiiixxx --- ext/opcache/zend_accelerator_module.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 80bc3f10da960..84b1856082209 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -230,7 +230,12 @@ static ZEND_INI_MH(OnEnable) return FAILURE; } } else { - *p = 0; + 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) != 0) { + *p = 0; + } return SUCCESS; } } From 509a328d07cc7d9191601e26be8ad96c20df004f Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 19 Aug 2013 07:09:47 +0100 Subject: [PATCH 4/7] ... --- ext/opcache/zend_accelerator_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 84b1856082209..2f66dc52ce008 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -233,7 +233,7 @@ static ZEND_INI_MH(OnEnable) 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) != 0) { + atoi(new_value) != 1) { *p = 0; } return SUCCESS; From d872d59a9c8d695da53e9cff37ed0c0a12a7af58 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 19 Aug 2013 07:10:54 +0100 Subject: [PATCH 5/7] .. --- ext/opcache/zend_accelerator_module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 2f66dc52ce008..163cf56352378 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -230,6 +230,7 @@ static ZEND_INI_MH(OnEnable) return FAILURE; } } else { + p = (zend_bool *) (base+(size_t) mh_arg1); 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) || From 7d22716f55c9da4b152091b35a625f77bffb40a7 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 19 Aug 2013 07:13:42 +0100 Subject: [PATCH 6/7] tidy --- ext/opcache/zend_accelerator_module.c | 46 ++++++++++++++------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 163cf56352378..85760d95eb3fc 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -212,32 +212,34 @@ static ZEND_INI_MH(OnEnable) stage == ZEND_INI_STAGE_SHUTDOWN || stage == ZEND_INI_STAGE_DEACTIVATE) { return OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - } else if (!ZCG(enabled)) { - /* It may be only temporary disabled */ - zend_bool *p; + } else { + /* 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 = (zend_bool *) (base+(size_t) mh_arg1); - 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; + 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; + } } } From f0a7beef7fe020d38f17eba55438ffc1998b01e5 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 19 Aug 2013 07:16:17 +0100 Subject: [PATCH 7/7] whitespace --- ext/opcache/zend_accelerator_module.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 85760d95eb3fc..8987e88b15dbc 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -214,7 +214,7 @@ static ZEND_INI_MH(OnEnable) 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; + zend_bool *p; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -223,23 +223,23 @@ static ZEND_INI_MH(OnEnable) 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; - } + 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; + } } }