Permalink
Browse files

rewrite fix issue #33

  • Loading branch information...
1 parent 2425f2f commit 1b246c15806b81d4834e6b12d59bfb00823ba6ae @it-can committed Jan 9, 2012
Showing with 13 additions and 5 deletions.
  1. +13 −5 system/core/Input.php
View
@@ -503,7 +503,7 @@ protected function _sanitize_globals()
foreach ($_COOKIE as $key => $val)
{
- $_COOKIE[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
+ $_COOKIE[$this->_clean_input_keys($key, true)] = $this->_clean_input_data($val, true);
}
}
@@ -530,14 +530,14 @@ protected function _sanitize_globals()
* @param string
* @return string
*/
- protected function _clean_input_data($str)
+ protected function _clean_input_data($str, $cookie = false)
{
if (is_array($str))
{
$new_array = array();
foreach ($str as $key => $val)
{
- $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
+ $new_array[$this->_clean_input_keys($key, $cookie)] = $this->_clean_input_data($val, $cookie);
}
return $new_array;
}
@@ -588,11 +588,19 @@ protected function _clean_input_data($str)
* @param string
* @return string
*/
- protected function _clean_input_keys($str)
+ protected function _clean_input_keys($str, $cookie = false)
{
if ( ! preg_match('/^[a-z0-9:_\/-]+$/i', $str))
{
- exit('Disallowed Key Characters.');
+ //if $cookie true will unset it
+ if ($cookie)
+ {
+ unset($_COOKIE[$str]);
+ }
+ else
+ {
+ exit('Disallowed Key Characters.');
+ }
}
// Clean UTF-8 if supported

0 comments on commit 1b246c1

Please sign in to comment.