diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opcache/Optimizer/pass1_5.c | 6 | ||||
-rw-r--r-- | ext/opcache/zend_persist.c | 6 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 17 |
3 files changed, 18 insertions, 11 deletions
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 4e1410a76e..cae7e80375 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -218,16 +218,16 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* substitute __COMPILER_HALT_OFFSET__ constant */ zend_bool orig_in_execution = EG(in_execution); zend_op_array *orig_op_array = EG(active_op_array); - zval offset; + zval *offset; EG(in_execution) = 1; EG(active_op_array) = op_array; - if (zend_get_constant("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1, &offset TSRMLS_CC)) { + if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { zend_uint tv = ZEND_RESULT(opline).var; literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); - replace_tmp_by_const(op_array, opline, tv, &offset TSRMLS_CC); + replace_tmp_by_const(op_array, opline, tv, offset TSRMLS_CC); } EG(active_op_array) = orig_op_array; EG(in_execution) = orig_in_execution; diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 39a2aa4a7c..bc63705e5e 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -198,15 +198,15 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc if (main_persistent_script) { zend_bool orig_in_execution = EG(in_execution); zend_op_array *orig_op_array = EG(active_op_array); - zval offset; + zval *offset; #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO main_persistent_script->early_binding = -1; #endif EG(in_execution) = 1; EG(active_op_array) = op_array; - if (zend_get_constant("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1, &offset TSRMLS_CC)) { - main_persistent_script->compiler_halt_offset = Z_LVAL(offset); + if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { + main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset); } EG(active_op_array) = orig_op_array; EG(in_execution) = orig_in_execution; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 7647781e2b..0393917e23 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3854,15 +3854,22 @@ PHP_MINFO_FUNCTION(basic) /* {{{ */ Given the name of a constant this function will return the constant's associated value */ PHP_FUNCTION(constant) { - char *const_name; - int const_name_len; + zend_string *const_name; + zval *c; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &const_name, &const_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &const_name) == FAILURE) { return; } - if (!zend_get_constant_ex(const_name, const_name_len, return_value, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", const_name); + c = zend_get_constant_ex(const_name, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC); + if (c) { + ZVAL_COPY_VALUE(return_value, c); + if (Z_CONSTANT_P(return_value)) { + zval_update_constant_ex(return_value, (void*)1, NULL TSRMLS_CC); + } + zval_copy_ctor(return_value); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", const_name->val); RETURN_NULL(); } } |