From dc1fd92b9b73a02cb0797ceeaac93e0d208e6b97 Mon Sep 17 00:00:00 2001 From: "Iskander (Alex) Sharipov" Date: Wed, 26 Aug 2020 17:23:10 +0300 Subject: [PATCH] Util/Zip: fix strpos args order `strpos()` first argument is a haystack, not a needle. `strpos('x', $s)` is identical to `$s === 'x'` which is probably not what we want here. --- src/Composer/Util/Zip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Util/Zip.php b/src/Composer/Util/Zip.php index ad6617edf..82cd34b71 100644 --- a/src/Composer/Util/Zip.php +++ b/src/Composer/Util/Zip.php @@ -92,7 +92,7 @@ class Zip } // handle archives which do not have a TOC record for the directory itself - if (false === strpos('\\', $dirname) && false === strpos('/', $dirname)) { + if (false === strpos($dirname, '\\') && false === strpos($dirname, '/')) { $topLevelPaths[$dirname.'/'] = true; if (\count($topLevelPaths) > 1) { throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));