[php-src] PR #25484: Fix leak of the static variables of a file loaded by spl_autoload()
| From: | lacatoire | Date: | Mon, 16 Nov 2026 13:29:33 +0000 |
| Subject: | [php-src] PR #25484: Fix leak of the static variables of a file loaded by spl_autoload() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40677@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25484
Author: lacatoire
spl_autoload() destroyed the op array of the loaded file without freeing its
static variables, unlike eval and the main script. A top-level
static in an
autoloaded file leaked.
To reproduce (debug build):
```php
<?php
set_include_path(__DIR__);
file_put_contents(__DIR__ . '/stat1.php', '<?php static $top = [1, 2, 3]; class
Stat1 {}');
spl_autoload('Stat1');
```
Before: memory leaks are reported. After: none.