mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

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
15 lines
304 B
PHP
15 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) {
|
|
}
|