Skip to content

Commit

Permalink
[+]: "UTF7 repack corrected" | thx @alechner
Browse files Browse the repository at this point in the history
-> #34

# Conflicts:
#	src/voku/helper/AntiXSS.php
  • Loading branch information
voku committed Apr 26, 2018
1 parent f56a398 commit 3f74c3c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/voku/helper/AntiXSS.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

namespace voku\helper;

/**
Expand Down Expand Up @@ -2435,7 +2433,7 @@ private function _compact_exploded_javascript($str)

// We only want to do this when it is followed by a non-word character
// That way valid stuff like "dealer to" does not become "dealerto".
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
'#(' . $word . ')(\W)#is',
array(
$this,
Expand All @@ -2461,7 +2459,7 @@ private function _decode_string($str)
$regExForHtmlTags = '/<\w+.*+/si';

if (preg_match($regExForHtmlTags, $str, $matches) === 1) {
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
$regExForHtmlTags,
array(
$this,
Expand Down Expand Up @@ -2558,7 +2556,7 @@ private function _remove_disallowed_javascript($str)
$original = $str;

if (stripos($str, '<a') !== false) {
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
'#<a[^a-z0-9>]+([^>]*?)(?:>|$)#i',
array(
$this,
Expand All @@ -2569,7 +2567,7 @@ private function _remove_disallowed_javascript($str)
}

if (stripos($str, '<img') !== false) {
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
'#<img[^a-z0-9]+([^>]*?)(?:\s?/?>|$)#i',
array(
$this,
Expand All @@ -2580,7 +2578,7 @@ private function _remove_disallowed_javascript($str)
}

if (stripos($str, '<audio') !== false) {
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
'#<audio[^a-z0-9]+([^>]*?)(?:\s?/?>|$)#i',
array(
$this,
Expand All @@ -2591,7 +2589,7 @@ private function _remove_disallowed_javascript($str)
}

if (stripos($str, '<video') !== false) {
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
'#<video[^a-z0-9]+([^>]*?)(?:\s?/?>|$)#i',
array(
$this,
Expand All @@ -2602,7 +2600,7 @@ private function _remove_disallowed_javascript($str)
}

if (stripos($str, '<source') !== false) {
$str = preg_replace_callback(
$str = (string)\preg_replace_callback(
'#<source[^a-z0-9]+([^>]*?)(?:\s?/?>|$)#i',
array(
$this,
Expand Down Expand Up @@ -2678,7 +2676,7 @@ private function _remove_evil_attributes($str)
*/
private function _repack_utf7($str)
{
return preg_replace_callback(
return (string)\preg_replace_callback(
'#\+([0-9a-zA-Z]+)\-#',
array($this, '_repack_utf7_callback'),
$str
Expand Down Expand Up @@ -2748,7 +2746,7 @@ private function _repack_utf7_callback_back($str)
private function _sanitize_naughty_html($str)
{
$evil_html_tags = \implode('|', $this->_evil_html_tags);
$str = \preg_replace_callback(
$str = (string)\preg_replace_callback(
'#<(/*\s*)(' . $evil_html_tags . ')([^><]*)([><]*)#i',
array(
$this,
Expand Down

0 comments on commit 3f74c3c

Please sign in to comment.