Browse Source

Merge pull request #8865 from Ayesh/regex-improvements

Regex improvements with unnecessary `.*` matchers
Jordi Boggiano 4 years ago
parent
commit
c39391323d

+ 1 - 1
src/Composer/Downloader/SvnDownloader.php

@@ -178,7 +178,7 @@ class SvnDownloader extends VcsDownloader
      */
     protected function getCommitLogs($fromReference, $toReference, $path)
     {
-        if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
+        if (preg_match('{@(\d+)$}', $fromReference) && preg_match('{@(\d+)$}', $toReference)) {
             // retrieve the svn base url from the checkout folder
             $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
             if (0 !== $this->process->execute($command, $output, $path)) {

+ 1 - 1
src/Composer/Repository/ComposerRepository.php

@@ -997,7 +997,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
         }
 
         // url-encode $ signs in URLs as bad proxies choke on them
-        if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
+        if (($pos = strpos($filename, '$')) && preg_match('{^https?://}i', $filename)) {
             $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
         }