diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-04 15:26:26 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-04 15:26:26 +0900 |
| commit | 1fdbfc1a277a788f8317ed47fccda22c587d3363 (patch) | |
| tree | 21e562b53122aaa5dd1d068d912c201454c040e9 /crates/shirabe/src/util | |
| parent | 51653e3e2f09df1d03454b25630c933764551970 (diff) | |
| download | php-shirabe-1fdbfc1a277a788f8317ed47fccda22c587d3363.tar.gz php-shirabe-1fdbfc1a277a788f8317ed47fccda22c587d3363.tar.zst php-shirabe-1fdbfc1a277a788f8317ed47fccda22c587d3363.zip | |
fix(pcre): restore missing regex delimiters in ported patterns
Several Preg::*() call sites lost their PHP delimiter (and in one case
the `i` modifier) during porting, since preg_*() expects the delimiter
to be preserved in the caller's pattern literal and stripped internally.
This made compile_php_pattern panic or silently misparse the pattern.
Un-ignore the Version tests that were blocked by this bug.
Diffstat (limited to 'crates/shirabe/src/util')
| -rw-r--r-- | crates/shirabe/src/util/composer_mirror.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/shirabe/src/util/composer_mirror.rs b/crates/shirabe/src/util/composer_mirror.rs index c0ff8d8..31f7127 100644 --- a/crates/shirabe/src/util/composer_mirror.rs +++ b/crates/shirabe/src/util/composer_mirror.rs @@ -15,7 +15,7 @@ impl ComposerMirror { pretty_version: Option<&str>, ) -> String { let reference = reference.map(|r| { - if Preg::is_match(r"^([a-f0-9]*|%reference%)$", r) { + if Preg::is_match(r"{^([a-f0-9]*|%reference%)$}", r) { r.to_string() } else { hash("md5", r) @@ -56,7 +56,7 @@ impl ComposerMirror { let mut gh_matches: indexmap::IndexMap<CaptureKey, String> = indexmap::IndexMap::new(); let mut bb_matches: indexmap::IndexMap<CaptureKey, String> = indexmap::IndexMap::new(); let normalized_url = if Preg::match3( - r"^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$", + r"#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#", url, Some(&mut gh_matches), ) { @@ -72,7 +72,7 @@ impl ComposerMirror { .unwrap_or_default(), ) } else if Preg::match3( - r"^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$", + r"#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#", url, Some(&mut bb_matches), ) { @@ -88,7 +88,7 @@ impl ComposerMirror { .unwrap_or_default(), ) } else { - Preg::replace(r"[^a-z0-9_.-]", "-", url.trim_matches('/')) + Preg::replace(r"{[^a-z0-9_.-]}i", "-", url.trim_matches('/')) }; ["%package%", "%normalizedUrl%", "%type%"] |
