Req #52813 [Fbk->NoF]: Filter Vars Missing Types (Update Types)
| From: | php-bugs at lists dot php dot net | Date: | Sun, 18 Jan 2015 04:22:19 +0000 |
| Subject: | Req #52813 [Fbk->NoF]: Filter Vars Missing Types (Update Types) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190018@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52813&edit=1
ID: 52813
Updated by: php-bugs@lists.php.net
Reported by: takingsides at gmail dot com
Summary: Filter Vars Missing Types (Update Types)
-Status: Feedback
+Status: No Feedback
Type: Feature/Change Request
Package: Filter related
PHP Version: *
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-01-10 21:55:24] danack@php.net
Hi,
Making this change would be a backwards compatibility break, as suddenly people who have code that
expects "T" and "Y" to produce false, would suddenly find their code was
behaving differently.
If you still think this behaviour change is a good idea, then you should discuss it as a change in
the PHP internals mailing list (http://php.net/mailing-lists.php) and then raise an RFC for the
change to be made.
------------------------------------------------------------------------
[2010-09-10 16:46:16] takingsides at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=52813&edit=1