Skip to content

Commit 3c50e94

Browse files
stronk7robocoder
authored andcommitted
preg_replace() requires quoting, specially for PHP 7.3 (#91)
Without this, a number of expressions fail (returning NULL), leading to both non matches and warning/error: Warning: preg_replace(): Compilation failed: number too big in {} quantifier at offset 6 This is specially noticeable under PHP 7.3, where the new PCRE2 engine is more picky and has more features, but also may help some cases with previous PHP versions, depending of the string being searched/replaced.
1 parent 7047d4c commit 3c50e94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/WebDriver/Element.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ public function getID()
129129
*/
130130
protected function getElementPath($elementId)
131131
{
132-
return preg_replace(sprintf('/%s$/', $this->id), $elementId, $this->url);
132+
return preg_replace(sprintf('/%s$/', preg_quote($this->id)), $elementId, $this->url);
133133
}
134134
}

0 commit comments

Comments
 (0)