1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  Fix pcre leak test (#21327)
This commit is contained in:
ndossche
2026-03-02 18:51:52 +01:00

View File

@@ -5,7 +5,7 @@ Memory leak in preg_match() frameless function with invalid regex and object arg
class Str {
private $val;
public function __construct($val) {
$this->val = $val;
$this->val = str_repeat($val, random_int(1, 1));
}
public function __toString() {
return $this->val;
@@ -15,10 +15,7 @@ class Str {
$regex = new Str("invalid regex");
$subject = new Str("some subject");
// Running in a loop to ensure leak detection if run with memory tools
for ($i = 0; $i < 100; $i++) {
@preg_match($regex, $subject);
}
@preg_match($regex, $subject);
echo "Done";
?>