com php-src: Merge branch 'PHP-7.1' into PHP-7.2: ext/standard/filters.c

From: Date: Thu, 05 Jul 2018 17:11:25 +0000
Subject: com php-src: Merge branch 'PHP-7.1' into PHP-7.2: ext/standard/filters.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102429@lists.php.net to get a copy of this message
Commit: f3dc67b25553a4d1a32c3705d2cfe06c52d55fa6 Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 5 Jul 2018 19:11:25 +0200 Parents: e5ef7cbe8749554ed6ce67a1bd734f3c4cb3eb25 791f07e4f06a943bd7892bdc539a7313fb3d6d1e Branches: PHP-7.2 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f3dc67b25553a4d1a32c3705d2cfe06c52d55fa6 Log: Merge branch 'PHP-7.1' into PHP-7.2 Changed paths: MM ext/standard/filters.c Diff: diff --cc ext/standard/filters.c index a2f8125,7115c53..55b5a9d --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@@ -172,16 -172,18 +172,18 @@@ static php_stream_filter_factory strfil typedef struct _php_strip_tags_filter { const char *allowed_tags; int allowed_tags_len; - int state; - int persistent; + uint8_t state; + uint8_t persistent; } php_strip_tags_filter; - static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, const char *allowed_tags, size_t allowed_tags_len, int persistent) + static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent) { if (allowed_tags != NULL) { - inst->allowed_tags = pemalloc(allowed_tags_len, persistent); - memcpy((char *)inst->allowed_tags, allowed_tags, allowed_tags_len); - inst->allowed_tags_len = (int)allowed_tags_len; + if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) { + return FAILURE; + } + memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1); + inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags); } else { inst->allowed_tags = NULL; } @@@ -242,15 -244,22 +244,17 @@@ static php_stream_filter_ops strfilter_ "string.strip_tags" }; -static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, int persistent) +static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent) { php_strip_tags_filter *inst; - smart_str tags_ss = {0}; + php_stream_filter *filter = NULL; + zend_string *allowed_tags = NULL;; inst = pemalloc(sizeof(php_strip_tags_filter), persistent); - if (inst == NULL) { /* it's possible pemalloc returns NULL - instead of causing it to bail out */ - return NULL; - } - if (filterparams != NULL) { if (Z_TYPE_P(filterparams) == IS_ARRAY) { + smart_str tags_ss = {0}; zval *tmp; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) {

« previous php.cvs (#102429) next »