- 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).
/* #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);
- 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);
+ handle_default:
+ 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);
}
}
}