Skip to content

Commit 628dc9a

Browse files
committed
fixes
1 parent 01d5e2f commit 628dc9a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Http/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function ipMatch($ip, $mask)
5050
$size = $size === '' ? 0 : $max - $size;
5151
}
5252
$bits = implode('', array_map(function ($n) {
53-
return sprintf('%032b', $n);
53+
return sprintf('%032b', $n);
5454
}, $arr));
5555
return substr($bits, 0, $max - $size) === substr($bits, $max, $max - $size);
5656
}

src/Http/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function redirect($url, $code = self::S302_FOUND)
153153
{
154154
$this->setCode($code);
155155
$this->setHeader('Location', $url);
156-
if (preg_match('#^https?:|^[a-z0-9+.-]++[^:]#i', $url)) {
156+
if (preg_match('#^https?:|^\s*+[a-z0-9+.-]*+[^:]#i', $url)) {
157157
$escapedUrl = htmlSpecialChars($url, ENT_IGNORE | ENT_QUOTES);
158158
echo "<h1>Redirect</h1>\n\n<p><a href=\"$escapedUrl\">Please click here to continue</a>.</p>";
159159
}

tests/Http/Response.redirect.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (PHP_SAPI !== 'cli') {
2323

2424

2525
ob_start();
26-
$response->redirect('javascript:alert(1)');
26+
$response->redirect(' javascript:alert(1)');
2727
Assert::same('', ob_get_clean());
2828

2929
if (PHP_SAPI !== 'cli') {

0 commit comments

Comments
 (0)