ID:               50632
 Updated by:       il...@php.net
 Reported By:      gmblar+php at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Filter related
 Operating System: *
 PHP Version:      5.3.1
 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2010-01-03 22:58:38] s...@php.net

Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=293051
Log: Fixed bug #50632 (filter_input() does not return default value if
the variable does not exist)

------------------------------------------------------------------------

[2010-01-02 09:38:41] gmblar+php at gmail dot com

Description:
------------
if $_GET['foo'] is undefined, filter functions return NULL instead of 
the default value defined in options.

Reproduce code:
---------------
<?php

$foo = filter_input(INPUT_GET, 'foo', FILTER_VALIDATE_INT, array(
    'flags' => FILTER_REQUIRE_SCALAR,
    'options' => array(
        'default' => 23,
        'min_range' => 5,
        'max_range' => 42
    )
));

var_dump($foo);

?>

Expected result:
----------------
int(23)

Actual result:
--------------
NULL


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50632&edit=1

Reply via email to