Replace preg_match by strpos

main
Jordi Boggiano 9 years ago
parent 5214620f05
commit d2e97eecb2

@ -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>';

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

Loading…
Cancel
Save