Skip to content

Commit e7dffdc

Browse files
committed
add test
1 parent 53f8369 commit e7dffdc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Memory leak in preg_match() frameless function with invalid regex and object arguments
3+
--FILE--
4+
<?php
5+
class Str {
6+
private $val;
7+
public function __construct($val) {
8+
$this->val = $val;
9+
}
10+
public function __toString() {
11+
return $this->val;
12+
}
13+
}
14+
15+
$regex = new Str("invalid regex");
16+
$subject = new Str("some subject");
17+
18+
// Running in a loop to ensure leak detection if run with memory tools
19+
for ($i = 0; $i < 100; $i++) {
20+
@preg_match($regex, $subject);
21+
}
22+
23+
echo "Done";
24+
?>
25+
--EXPECT--
26+
Done

0 commit comments

Comments
 (0)