mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
ee000ea186
We may OOM during object initialization. In this case, free_obj needs to guard against NULL values. There may be more cases where this is an issue, these were the ones I was able to discover via script. Fixes GH-11734
16 lines
304 B
PHP
16 lines
304 B
PHP
<?php
|
|
|
|
$mb_used = (int) ceil(memory_get_usage() / (1024 ** 2));
|
|
ini_set('memory_limit', ($mb_used + 1) . 'M');
|
|
|
|
$class = $argv[1];
|
|
$objects = [];
|
|
|
|
try {
|
|
while (true) {
|
|
$rc = new ReflectionClass($class);
|
|
$objects[] = $rc->newInstanceWithoutConstructor();
|
|
}
|
|
} catch (Throwable) {
|
|
}
|