Skip to content

Commit e8e41aa

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
2 parents e5ff8b2 + 1a30a7a commit e8e41aa

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PHP NEWS
99
- Filter:
1010
. Fixed bug #72972 (Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and
1111
FILTER_FLAG_NO_PRIV_RANGE). (julien)
12+
. Fixed bug #73054 (default option ignored when object passed to int filter).
13+
(cmb)
1214

1315
-GD:
1416
. Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).

ext/filter/filter.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static void php_zval_filter(zval *value, zend_long filter, zend_long flags, zval
397397
} else {
398398
ZVAL_FALSE(value);
399399
}
400-
return;
400+
goto handle_default;
401401
}
402402
}
403403

@@ -406,6 +406,7 @@ static void php_zval_filter(zval *value, zend_long filter, zend_long flags, zval
406406

407407
filter_func.function(value, flags, options, charset);
408408

409+
handle_default:
409410
if (options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) &&
410411
((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_P(value) == IS_NULL) ||
411412
(!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_P(value) == IS_FALSE)) &&

ext/filter/tests/bug73054.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Bug #73054 (default option ignored when object passed to int filter)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('filter')) die('skip filter extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
var_dump(
10+
filter_var(new stdClass, FILTER_VALIDATE_INT, [
11+
'options' => ['default' => 2],
12+
]),
13+
filter_var(new stdClass, FILTER_VALIDATE_INT, [
14+
'options' => ['default' => 2],
15+
'flags' => FILTER_NULL_ON_FAILURE
16+
])
17+
);
18+
?>
19+
===DONE===
20+
--EXPECT--
21+
int(2)
22+
int(2)
23+
===DONE===

0 commit comments

Comments
 (0)