xref: /PHP-8.0/ext/gmp/tests/bug67917.phpt (revision c6c9e71a)
1--TEST--
2Bug #67917: Using GMP objects with overloaded operators can cause memory exhaustion
3--SKIPIF--
4<?php if (!extension_loaded('gmp')) die('skip gmp extension not loaded'); ?>
5--FILE--
6<?php
7
8$mem1 = memory_get_usage();
9for ($i = 0; $i < 1000; $i++) {
10    $gmp = gmp_init(42);
11    $gmp <<= 1;
12}
13$mem2 = memory_get_usage();
14
15var_dump($mem2 - $mem1 < 100000);
16
17?>
18--EXPECT--
19bool(true)
20