From 9885d23e2a0aeee3079063059ab71e73fa7f5962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20St=C3=B8ylen?= Date: Sat, 20 May 2023 11:30:39 +0200 Subject: [PATCH] Ensure stripos() receives a string If file_get_contents() returns false, stripos() will throw a TypeError. Casting to string prevents this from happening. Closes #11470 --- src/Composer/Util/Platform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index 2d0c89d88..3c971d105 100644 --- a/src/Composer/Util/Platform.php +++ b/src/Composer/Util/Platform.php @@ -148,7 +148,7 @@ class Platform if ( !ini_get('open_basedir') && is_readable('/proc/version') - && false !== stripos(Silencer::call('file_get_contents', '/proc/version'), 'microsoft') + && false !== stripos((string)Silencer::call('file_get_contents', '/proc/version'), 'microsoft') && !file_exists('/.dockerenv') // docker running inside WSL should not be seen as WSL ) { return self::$isWindowsSubsystemForLinux = true;