php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58140 Add the ability to filter composite values
Submitted: 2008-04-04 08:07 UTC Modified: 2013-02-18 00:35 UTC
From: Jared dot Williams1 at ntlworld dot com Assigned: pajoye (profile)
Status: No Feedback Package: filter (PECL)
PHP Version: 5.2.5 OS:
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:
4 + 49 = ?
Subscribe to this entry?

 
 [2008-04-04 08:07 UTC] Jared dot Williams1 at ntlworld dot com
Description:
------------
It's common practice to combine several values into a single 
cookie. But there is no 
method of validating each of the values individually.

So proposing something along the lines of...


$values = array(
       'expires' => $_SERVER['REQUEST_TIME'] + 3600,
       'value' => 'foo';
);

setcookie('comp', http_build_query($values,'', '&'));


And to read & filter...


$v = filter_input(INPUT_COOKIE, 'comp', 
FILTER_VALIDATE_QUERY, array(
   'expires' => FILTER_VALIDATE_INT,
   'value' => ...
));






Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-04 08:10 UTC] pierre dot php at gmail dot com
Hi!

What's about filter_input_array (or filter_var_array)?
 [2008-04-12 12:23 UTC] Jared dot Williams1 at ntlworld dot com
Isn't there a possible issue with double encoding with having to use filter 
twice?

$cookie = filter_input(INPUT_FILTER, 'foo');

parse_str($cookie, $v);

filter_input_array($v, ... );

?
 [2008-04-12 13:10 UTC] pierre dot php at gmail dot com
I don't understand your question, what would you like to achieve? Please use a complete code snippet to illustrate it and add an explanation, it may help :)
 [2013-02-18 00:35 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 "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC