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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
28 + 15 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 04:01:27 2024 UTC