[php-src] Issue #22422: zend_test_compile_to_ast leaks memory when PHP is compiled with --enable-address-sanitizer

From: Date: Wed, 24 Jun 2026 09:13:49 +0000
Subject: [php-src] Issue #22422: zend_test_compile_to_ast leaks memory when PHP is compiled with --enable-address-sanitizer
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252260@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/22422 Author: mainframe98 ### Description When compiling zend_test using phpize with --enable-address-sanitizer, several tests using zend_test_compile_to_ast report memory leaks (e.g. compile_to_ast/basic_ast.phpt): ``` 'php-src/ext/zend_test/tests/compile_to_ast/basic_ast.php' php-src/Zend/zend_arena.h(171) : Freeing 0x00007f6290803030 (16 bytes), script=php-src/ext/zend_test/tests/compile_to_ast/basic_ast.php Last leak repeated 77 times === Total 78 memory leaks detected === ``` I'm writing an extension modifies the ast, and its tests dumps the ast after the extension has modified the ast, but those tests keep failing because of the reported memory leaks. As this happens also in zend_test, the cause has to lie in PHP itself. Unfortunately, I don't know enough about address santization to know whether I've stumbled across a bug, or if I'm doing something wrong. I compiled PHP with: ``` ./buildconf ./configure --disable-all --enable-debug --enable-mbstring --disable-mbregex --enable-address-sanitizer --enable-tokenizer make -j6 make install ``` ### PHP Version ```plain PHP 8.6.0-dev (cli) (built: Jun 24 2026 10:50:55) (NTS DEBUG) Copyright © The PHP Group and Contributors Zend Engine v4.6.0-dev, Copyright © Zend by Perforce with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce (Compiled from 6f0aa11d23a350e01f4d14112333281eb2b0d77a) ``` ### Operating System Debian 13.5

« previous php.bugs (#252260) next »