default option ignored when object passed to int filter
| Bug #73054 | default option ignored when object passed to int filter | ||||
|---|---|---|---|---|---|
| Submitted: | 2016-09-09 08:46 UTC | Modified: | 2020-06-08 14:21 UTC | ||
| From: | dormilich at netscape dot net | Assigned: | cmb (profile) | ||
| Status: | Closed | Package: | Filter related | ||
| PHP Version: | 5.6.25 | OS: | Mac OS X 10.11.6 | ||
| Private report: | No | CVE-ID: | None | ||
[2016-09-09 08:46 UTC] dormilich at netscape dot net
Description:
------------
When any object is passed through filter_var() with the FILTER_VALIDATE_INT filter and a default option the result is always boolean false instead of the default value.
Second, the FILTER_NULL_ON_FAILURE flag also shows no effect on passed objects.
Test script:
---------------
<?php
$id = filter_var(new stdClass, FILTER_VALIDATE_INT, [
'options' => ['default' => 2],
]);
var_dump($id);
Expected result:
----------------
int(2)
Actual result:
--------------
bool(false)
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2016-09-09 10:23 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
[2016-09-09 10:23 UTC] cmb@php.net
[2016-09-09 12:52 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
[2017-06-04 01:38 UTC] yohgaki@php.net
[2017-06-07 22:10 UTC] yohgaki@php.net
-Status: Closed +Status: Re-Opened -Assigned To: cmb +Assigned To: yohgaki
[2017-06-07 22:10 UTC] yohgaki@php.net
[2017-06-07 22:45 UTC] yohgaki@php.net
[2017-10-24 03:07 UTC] kalle@php.net
-Status: Re-Opened +Status: Assigned
[2020-06-08 14:21 UTC] cmb@php.net
-Status: Assigned +Status: Closed -Assigned To: yohgaki +Assigned To: cmb
[2020-06-08 14:21 UTC] cmb@php.net