Browse Source

Replace preg_match by strpos

Jordi Boggiano 9 years ago
parent
commit
d2e97eecb2
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/Composer/Command/DiagnoseCommand.php
  2. 1 1
      src/Composer/Factory.php

+ 1 - 1
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[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
                 $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
                 $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';

+ 1 - 1
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('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
                 $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
                 if (PHP_VERSION_ID < 50600) {