summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLéopold Jacquot <leopold.jacquot@infomaniak.com>2019-12-04 15:14:50 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-23 14:53:28 +0100
commitf720fb1e21f374bf84f5f6ce295175f369bc1291 (patch)
tree8c9f66aab22b925f919642c6d15f59a474cff54a
parentdb9776c53c50d923a26657fa150dfb2a482a6507 (diff)
downloadphp-git-f720fb1e21f374bf84f5f6ce295175f369bc1291.tar.gz
Add unit test for bug #78902
-rw-r--r--ext/standard/tests/streams/bug78902.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/standard/tests/streams/bug78902.phpt b/ext/standard/tests/streams/bug78902.phpt
new file mode 100644
index 0000000000..43b271fe27
--- /dev/null
+++ b/ext/standard/tests/streams/bug78902.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #78902: Memory leak when using stream_filter_append
+--XFAIL--
+This bug was introduced in PHP 7.3.11 an is still open
+--INI--
+memory_limit=512k
+--FILE--
+<?php
+
+/** create temporary file 2mb file */
+$tmp_file_name = tempnam(sys_get_temp_dir(), 'test_');
+$fp = fopen($tmp_file_name, 'w+');
+$size = 1024 * 1024 * 2; // 2mb
+$chunk = 1024;
+while ($size > 0) {
+ fputs($fp, str_pad('', min($chunk,$size)));
+ $size -= $chunk;
+}
+fclose($fp);
+
+$fp = fopen($tmp_file_name, 'r');
+stream_filter_append($fp, "string.toupper");
+while (!feof($fp)) {
+ fread($fp, 1);
+}
+fclose($fp);
+var_dump(true);
+?>
+--EXPECT--
+bool(true)