summaryrefslogtreecommitdiff
path: root/ext/gmp/tests/bug67917.phpt
blob: ce376349012b9ce2d9f25afb323803efeefadcbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--TEST--
Bug #67917: Using GMP objects with overloaded operators can cause memory exhaustion
--SKIPIF--
<?php if (!extension_loaded('gmp')) die('skip gmp extension not loaded'); ?>
--FILE--
<?php

$mem1 = memory_get_usage();
for ($i = 0; $i < 1000; $i++) {
    $gmp = gmp_init(42);
    $gmp <<= 1;
}
$mem2 = memory_get_usage();

var_dump($mem2 - $mem1 < 100000);

?>
--EXPECT--
bool(true)