|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-01 16:25 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Filter related
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 17:00:01 2025 UTC |
Description: ------------ Add constant FILTER_EXCEPTION_ON_FAILURE to throw meaningful exceptions why filter fails Reproduce code: --------------- <?php $foo = filter_input(INPUT_GET, 'foo', FILTER_VALIDATE_INT, array( 'flags' => FILTER_REQUIRE_SCALAR + FILTER_EXCEPTION_ON_FAILURE, 'options' => array( 'min_range' => 5, 'max_range' => 42 ) )); var_dump($foo); ?> Expected result: ---------------- Fatal error: Uncaught exception 'OutOfBoundsException' with message 'foo must an integer in range between 5 and 42' in input.php:3 Stack trace: #0 {main} thrown in input.php on line 3 Actual result: -------------- bool(false)