We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 53f8369 commit 2e5322cCopy full SHA for 2e5322c
1 file changed
ext/pcre/tests/preg_match_frameless_leak.phpt
@@ -0,0 +1,27 @@
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
+?>
26
+--EXPECT--
27
+Done
0 commit comments