convert_to_string(*value);
filter_func.function(*value, flags, options, charset TSRMLS_CC);
+
+ if (
+ options &&
+ ((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) {
+ **value = **tmp;
+ zval_copy_ctor(*value);
+ }
+ }
}
/* }}} */
if (!input || !HASH_OF(input) || zend_hash_find(HASH_OF(input), var, var_len + 1, (void **)&tmp) != SUCCESS) {
long filter_flags = 0;
- zval **option;
+ zval **option, **opt, **def;
if (filter_args) {
if (Z_TYPE_PP(filter_args) == IS_LONG) {
filter_flags = Z_LVAL_PP(filter_args);
} else if (Z_TYPE_PP(filter_args) == IS_ARRAY && zend_hash_find(HASH_OF(*filter_args), "flags", sizeof("flags"), (void **)&option) == SUCCESS) {
convert_to_long(*option);
filter_flags = Z_LVAL_PP(option);
+ } else if (Z_TYPE_PP(filter_args) == IS_ARRAY &&
+ zend_hash_find(HASH_OF(*filter_args), "options", sizeof("options"), (void **)&opt) == SUCCESS &&
+ zend_hash_find(HASH_OF(*opt), "default", sizeof("default"), (void **)&def) == SUCCESS
+ ) {
+ *return_value = **def;
+ zval_copy_ctor(return_value);
+ return;
}
}
if (filter_flags & FILTER_NULL_ON_FAILURE) {