From: Christoph M. Becker Date: Fri, 9 Sep 2016 12:33:01 +0000 (+0200) Subject: Merge branch 'PHP-5.6' into PHP-7.0 X-Git-Tag: php-7.1.0RC2~43^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a30a7a4222c255f96258328e175f4cbd807a4e0;p=php Merge branch 'PHP-5.6' into PHP-7.0 --- 1a30a7a4222c255f96258328e175f4cbd807a4e0 diff --cc NEWS index cf13e4ad8d,831293f7cc..3b848264ae --- a/NEWS +++ b/NEWS @@@ -9,6 -9,10 +9,8 @@@ PH - Filter: . Fixed bug #72972 (Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and FILTER_FLAG_NO_PRIV_RANGE). (julien) - . Fixed bug #67167 (Wrong return value from FILTER_VALIDATE_BOOLEAN, - FILTER_NULL_ON_FAILURE). (levim, cmb) + . Fixed bug #73054 (default option ignored when object passed to int filter). + (cmb) - GD: . Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette). diff --cc ext/filter/filter.c index 2c8dde9d49,5b79667bd9..613c0b75ea --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@@ -383,34 -375,37 +383,35 @@@ static void php_zval_filter(zval *value /* #49274, fatal error with object without a toString method Fails nicely instead of getting a recovarable fatal error. */ - if (Z_TYPE_PP(value) == IS_OBJECT) { + if (Z_TYPE_P(value) == IS_OBJECT) { zend_class_entry *ce; - ce = Z_OBJCE_PP(value); + ce = Z_OBJCE_P(value); if (!ce->__tostring) { - zval_dtor(*value); + zval_ptr_dtor(value); /* #67167: doesn't return null on failure for objects */ if (flags & FILTER_NULL_ON_FAILURE) { - ZVAL_NULL(*value); + ZVAL_NULL(value); } else { - ZVAL_FALSE(*value); + ZVAL_FALSE(value); } - return; + goto handle_default; } } /* Here be strings */ - convert_to_string(*value); + convert_to_string(value); - filter_func.function(*value, flags, options, charset TSRMLS_CC); + filter_func.function(value, flags, options, charset); + handle_default: - if ( - options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) && - ((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_PP(value) == IS_NULL) || - (!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_PP(value) == IS_BOOL && Z_LVAL_PP(value) == 0)) && - zend_hash_exists(HASH_OF(options), "default", sizeof("default")) - ) { - zval **tmp; - if (zend_hash_find(HASH_OF(options), "default", sizeof("default"), (void **)&tmp) == SUCCESS) { - MAKE_COPY_ZVAL(tmp, *value); + if (options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) && + ((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_P(value) == IS_NULL) || + (!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_P(value) == IS_FALSE)) && + zend_hash_str_exists(HASH_OF(options), "default", sizeof("default") - 1)) { + zval *tmp; + if ((tmp = zend_hash_str_find(HASH_OF(options), "default", sizeof("default") - 1)) != NULL) { + ZVAL_COPY(value, tmp); } } }