Bug #73054 [NEW]: default option ignored when object passed to int filter

From: Date: Fri, 09 Sep 2016 08:46:30 +0000
Subject: Bug #73054 [NEW]: default option ignored when object passed to int filter
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203904@lists.php.net to get a copy of this message
From: dormilich at netscape dot net Operating system: Mac OS X 10.11.6 PHP version: 5.6.25 Package: Filter related Bug Type: Bug Bug description:default option ignored when object passed to int filter 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) -- Edit bug report at https://bugs.php.net/bug.php?id=73054&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73054&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73054&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73054&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73054&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73054&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73054&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73054&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73054&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73054&r=support Expected behavior: https://bugs.php.net/fix.php?id=73054&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73054&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73054&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73054&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73054&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73054&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73054&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73054&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73054&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73054&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73054&r=mysqlcfg

« previous php.bugs (#203904) next »