From da94ef2e433d77af516d69c0f7d3c1b8ecd566dc Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sun, 7 Mar 2021 13:07:08 +0100 Subject: [PATCH] Fixed wrong parameter order in explode() (#2866) --- src/Utils.php | 2 +- tests/UtilsTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Utils.php b/src/Utils.php index f4848b74b..508144ae2 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -232,7 +232,7 @@ public static function isHostInNoProxy(string $host, array $noProxyArray): bool // Strip port if present. if (\strpos($host, ':')) { /** @var string[] $hostParts will never be false because of the checks above */ - $hostParts = \explode($host, ':', 2); + $hostParts = \explode(':', $host, 2); $host = $hostParts[0]; } diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 8784a0cff..04eb89df4 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -117,6 +117,7 @@ public function noProxyProvider() return [ ['mit.edu', ['.mit.edu'], false], ['foo.mit.edu', ['.mit.edu'], true], + ['foo.mit.edu:123', ['.mit.edu'], true], ['mit.edu', ['mit.edu'], true], ['mit.edu', ['baz', 'mit.edu'], true], ['mit.edu', ['', '', 'mit.edu'], true],