summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug42369.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/simplexml/tests/bug42369.phpt')
-rw-r--r--ext/simplexml/tests/bug42369.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/simplexml/tests/bug42369.phpt b/ext/simplexml/tests/bug42369.phpt
new file mode 100644
index 000000000..e5df81460
--- /dev/null
+++ b/ext/simplexml/tests/bug42369.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #42369 (Implicit conversion to string leaks memory)
+--SKIPIF--
+<?php if (!extension_loaded('simplexml')) echo 'skip simplexml extension is not loaded'; >
+--FILE--
+<?php
+ $xml = '<?xml version="1.0" encoding="utf-8"?>';
+ $x = simplexml_load_string($xml . "<q><x>foo</x></q>");
+
+ echo 'explicit conversion' . PHP_EOL;
+ for ($i = 0; $i < 100000; $i++) {
+ md5(strval($x->x));
+ }
+
+ echo 'no conversion' . PHP_EOL;
+ for ($i = 0; $i < 100000; $i++) {
+ md5($x->x);
+ }
+
+ echo 'done' . PHP_EOL;
+?>
+--EXPECT--
+explicit conversion
+no conversion
+done \ No newline at end of file