com php-src: Merge branch 'PHP-5.6' into PHP-7.0: NEWS ext/filter/filter.c
| From: | Christoph Michael Becker | Date: | Fri, 09 Sep 2016 12:34:11 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6' into PHP-7.0: NEWS ext/filter/filter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94396@lists.php.net to get a copy of this message | ||
Commit: 1a30a7a4222c255f96258328e175f4cbd807a4e0
Author: Christoph M. Becker <cmbecker69@gmx.de> Fri, 9 Sep 2016 14:33:01 +0200
Parents: 807c49e6bed7d1cdc7c668dd56b0adefe3756f38 23e721fc9303dd7423f989f6ff360cdff74aeca1
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a30a7a4222c255f96258328e175f4cbd807a4e0
Log:
Merge branch 'PHP-5.6' into PHP-7.0
Changed paths:
MM NEWS
MM ext/filter/filter.c
Diff:
diff --cc NEWS
index cf13e4a,831293f..3b84826
--- 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 2c8dde9,5b79667..613c0b7
--- 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);
}
}
}