diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 23624ce6bcc7..8e937a9782c3 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -24,7 +24,6 @@ #include "func_interceptors.h" #include "ext/standard/crc32.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_string.h" /* For php_stristr() */ #include "ext/standard/info.h" #include "zend_smart_str.h" @@ -53,8 +52,9 @@ static int phar_set_writeable_bit(zval *zv, void *argument) /* {{{ */ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */ { bool old, ini; + bool modifying_readonly_ini = ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1; - if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) { + if (modifying_readonly_ini) { old = PHAR_G(readonly_orig); } else { old = PHAR_G(require_hash_orig); @@ -64,7 +64,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */ /* do not allow unsetting in runtime */ if (stage == ZEND_INI_STAGE_STARTUP) { - if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) { + if (modifying_readonly_ini) { PHAR_G(readonly_orig) = ini; } else { PHAR_G(require_hash_orig) = ini; @@ -73,7 +73,7 @@ ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */ return FAILURE; } - if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) { + if (modifying_readonly_ini) { PHAR_G(readonly) = ini; if (PHAR_G(request_init) && HT_IS_INITIALIZED(&PHAR_G(phar_fname_map))) { zend_hash_apply_with_argument(&(PHAR_G(phar_fname_map)), phar_set_writeable_bit, (void *)&ini); @@ -2536,7 +2536,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) int phar_flush_ex(phar_archive_data *phar, zen } if (user_stub) { - char *pos = php_stristr(ZSTR_VAL(user_stub), halt_stub, ZSTR_LEN(user_stub), strlen(halt_stub)); + const char *pos = php_memnistr(ZSTR_VAL(user_stub), halt_stub, strlen(halt_stub), ZSTR_VAL(user_stub)+ZSTR_LEN(user_stub)); if (pos == NULL) { if (must_close_old_file) {