php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56783 TRIM flag for $filter_options of string filter
Submitted: 2006-01-19 09:12 UTC Modified: 2017-01-29 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: email at steffenweber dot net Assigned: pajoye (profile)
Status: No Feedback Package: filter (PECL)
PHP Version: 5.1.1 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-01-19 09:12 UTC] email at steffenweber dot net
Description:
------------
As I trim() nearly all string inputs it would be very useful if there was a TRIM flag for the $filter_options parameter when sanitzing a string.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-13 22:02 UTC] pierre dot php at gmail dot com
I have a patch for that. it will be added after 0.10.0.
 [2006-05-26 04:59 UTC] dev at pixandlog dot com
I add a new comment.
Why input_get TRIM float and integer filter but NOT boolean filter in input ???
Exemple :
$_GET['myint'] = '  42  '; //OK
$_GET['myfloat'] = '    42.5    '; //OK
$_GET['myboolean'] = '     On '; //KO
 [2006-07-16 10:40 UTC] pierre dot php at gmail dot com
Because I added it for integer and float values. I think it makes sense to add trim white chars for numeric values, as does PHP itself in casting operations.

A trim tag would have other meanings when used with string values.
 [2006-08-31 15:24 UTC] pierre dot php at gmail dot com
int, float and boolean use trim now.

The trim flag will be added after 5.2.0RC3.
 [2007-11-12 22:31 UTC] luck dot hack at gmail dot com
In most case, most people need to trim STRING inputs.

In now days, we must trim $_POST like this

<?php
function trim_value(&$value){ 
    $value = trim($value); 
}
array_walk_recursive($_POST,'trim_value');
?>

I think we can write less code and get better performance, while do this job with filter extension.

hope you can understand i means, and sorry for my poor english :)
 [2017-01-20 21:56 UTC] heiglandreas@php.net
-Status: Assigned +Status: Feedback
 [2017-01-20 21:56 UTC] heiglandreas@php.net
Is this still relevant?
 [2017-01-29 04:22 UTC] pecl-dev at lists dot php dot net
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.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun May 19 12:01:26 2019 UTC