Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive XSS Filter #793

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Recursive XSS Filter
Edited the XXS Filter to not only accept individual values but also
arrays and objects. This is useful to use directly after a database
call.
  • Loading branch information
videsignz committed Feb 13, 2016
commit 846d0ab0491478e73f7cdd8651b0b3abdee72f94
14 changes: 12 additions & 2 deletions application/core/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ class Filter
public static function XSSFilter(&$value)
{
if (is_string($value)) {

$value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}

}elseif(is_array($value) || is_object($value)) {

foreach ($value as $key => &$array_value) {

self::XSSFilter($array_value);

}

}

return $value;
}
}
}