From 4842f213a1e1eee0502d5afb98ef37ff2463c562 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 30 Apr 2021 10:07:28 +0200 Subject: [PATCH] Also make sure type is correct for preg_match --- src/Composer/Package/Loader/ValidatingArrayLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 4c15a798c..64f97d436 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -326,7 +326,7 @@ class ValidatingArrayLoader implements LoaderInterface if (isset($this->config[$srcType]['reference']) && !is_string($this->config[$srcType]['reference']) && !is_int($this->config[$srcType]['reference'])) { $this->errors[] = $srcType . '.reference : should be a string or int, '.gettype($this->config[$srcType]['reference']).' given'; } - if (isset($this->config[$srcType]['reference']) && preg_match('{^\s*-}', $this->config[$srcType]['reference'])) { + if (isset($this->config[$srcType]['reference']) && preg_match('{^\s*-}', (string) $this->config[$srcType]['reference'])) { $this->errors[] = $srcType . '.reference : must not start with a "-", "'.$this->config[$srcType]['reference'].'" given'; } if (preg_match('{^\s*-}', $this->config[$srcType]['url'])) {