1
0
Fork 0

Replace preg_match by strpos

pull/4759/head
Jordi Boggiano 2016-01-10 20:43:33 +00:00
parent 5214620f05
commit d2e97eecb2
2 changed files with 2 additions and 2 deletions

View File

@ -188,7 +188,7 @@ EOT
try { try {
$this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false); $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
} catch (TransportException $e) { } 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>[' . 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>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>'; $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';

View File

@ -543,7 +543,7 @@ class Factory
try { try {
$remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls); $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
} catch (TransportException $e) { } 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>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>'); $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
if (PHP_VERSION_ID < 50600) { if (PHP_VERSION_ID < 50600) {