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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:25 2019 UTC