Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Zend/tests/include_repeat.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

if (!class_exists(Test::class)) {
class Test {
}
}
23 changes: 23 additions & 0 deletions Zend/tests/include_repeat.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Repeated include must not increase memory
--FILE--
<?php

$m = -1;
$mDiff = -1;
$mPrev = 0;
for ($i = 0; $i < 10 * 1000; $i++) {
require __DIR__ . '/include_repeat.inc';
$m = memory_get_usage();
$mDiff = $m - $mPrev;
if ($mPrev !== 0 && $mDiff !== 0) {
echo 'Increased memory detected: ' . $mDiff . ' B (' . $i . ' iteration)' . "\n";
exit(1);
}
$mPrev = $m;
}
echo 'done';

?>
--EXPECT--
done