PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | vendor/symfony/css-selector/Parser/Reader.php +7 -2 4.4.44.4.8 View file →
@@ -22,8 +22,10 @@
22 22 * @internal
23 23 */
24 24 class Reader
25 25 {
26 + private static array $anchoredPatterns = [];
27 +
26 28 private int $length;
27 29 private int $position = 0;
28 30
29 31 public function __construct(
@@ -60,11 +62,14 @@
60 62 }
61 63
62 64 public function findPattern(string $pattern): array|false
63 65 {
64 - $source = substr($this->source, $this->position);
66 + // Match in place instead of copying the remaining source before every probe.
67 + // Combined with an offset, "^" still anchors at the start of the whole subject,
68 + // so a leading anchor is turned into "\\G", which anchors at the offset instead.
69 + $pattern = self::$anchoredPatterns[$pattern] ??= '^' === ($pattern[1] ?? '') ? $pattern[0].'\\G'.substr($pattern, 2) : $pattern;
65 70
66 - if (preg_match($pattern, $source, $matches)) {
71 + if (preg_match($pattern, $this->source, $matches, 0, $this->position)) {
67 72 return $matches;
68 73 }
69 74
70 75 return false;