/hphp/test/zend/good/ext/exif/tests/bug68799.php
PHP | 34 lines | 23 code | 8 blank | 3 comment | 1 complexity | 18b5835859f94bea93352bed69776b82 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?hh
- /*
- * * Pollute the heap. Helps trigger bug. Sometimes not needed.
- * */
- class A {
- function __construct() {
- $a = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa';
- $this->a = $a . $a . $a . $a . $a . $a;
- }
- };
- function doStuff ($limit) {
- $a = new A;
- $b = darray[];
- for ($i = 0; $i < $limit; $i++) {
- $b[$i] = clone $a;
- }
- unset($a);
- gc_collect_cycles();
- }
- <<__EntryPoint>> function main(): void {
- $iterations = 3;
- doStuff($iterations);
- doStuff($iterations);
- gc_collect_cycles();
- print_r(exif_read_data(__DIR__.'/bug68799.jpg'));
- }