From d2e97eecb2275f01f01835baec41e97327e67796 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 10 Jan 2016 20:43:33 +0000 Subject: [PATCH] Replace preg_match by strpos --- src/Composer/Command/DiagnoseCommand.php | 2 +- src/Composer/Factory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index 23bee87e0..faf537a10 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -188,7 +188,7 @@ EOT try { $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false); } catch (TransportException $e) { - if (preg_match('|cafile|', $e->getMessage())) { + if (false !== strpos($e->getMessage(), 'cafile')) { $result[] = '[' . get_class($e) . '] ' . $e->getMessage() . ''; $result[] = 'Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.'; $result[] = 'You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.'; diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index b13696bc2..cf09b490a 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -543,7 +543,7 @@ class Factory try { $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls); } catch (TransportException $e) { - if (preg_match('{cafile}', $e->getMessage())) { + if (false !== strpos($e->getMessage(), 'cafile')) { $io->write('Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.'); $io->write('A valid CA certificate file is required for SSL/TLS protection.'); if (PHP_VERSION_ID < 50600) {