Req #52813 [NEW]: Filter Vars Missing Types (Update Types)
| From: | takingsides at gmail dot com | Date: | Fri, 10 Sep 2010 14:46:17 +0000 |
| Subject: | Req #52813 [NEW]: Filter Vars Missing Types (Update Types) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-154245@lists.php.net to get a copy of this message | ||
From:
Operating system: Irrelevant
PHP version: Irrelevant
Package: Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Filter Vars Missing Types (Update Types)
Description:
------------
I have been through one of the filter_vars() functions and have found some
attributes missing from the list...
The documentation states: "Returns TRUE for "1", "true", "on" and
"yes"."
However I feel this needs to be extended further to allocate two more
attributes to be triggered at "TRUE" there are...
"T" and "Y" (T = true, Y = Yes)
Test script:
---------------
<?php
$str = "1";
var_dump(filter_var($str, FILTER_VALIDATE_BOOLEAN)); // output: true
$str = "yes";
var_dump(filter_var($str, FILTER_VALIDATE_BOOLEAN)); // output: true
$str = "on";
var_dump(filter_var($str, FILTER_VALIDATE_BOOLEAN)); // output: true
$str = true;
var_dump(filter_var($str, FILTER_VALIDATE_BOOLEAN)); // output: true
// missing (potential bug):
$str = "t";
var_dump(filter_var($str, FILTER_VALIDATE_BOOLEAN)); // output: false
(should be true, t = true)
$str = "y";
var_dump(filter_var($str, FILTER_VALIDATE_BOOLEAN)); // output: false
(should be true, y = true)
--
Edit bug report at http://bugs.php.net/bug.php?id=52813&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52813&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52813&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52813&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52813&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52813&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52813&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52813&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52813&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52813&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52813&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52813&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52813&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52813&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52813&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52813&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52813&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52813&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52813&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52813&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52813&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52813&r=mysqlcfg