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) {