[php-src] Issue #19952: memory leak readline_info

From: Date: Thu, 25 Sep 2025 05:40:06 +0000
Subject: [php-src] Issue #19952: memory leak readline_info
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-250910@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/19952 Author: YuanchengJiang ### Description The following code: ```php <?php if (defined("pass3")) { } else if (defined("pass2")) { } else { define("pass2", 1); include(__FILE__); } var_dump(readline_info('readline_name', 1)); ``` Resulted in this output: ``` ================================================================= ==1767727==ERROR: LeakSanitizer: detected memory leaks Direct leak of 2 byte(s) in 1 object(s) allocated from: #0 0x66cd54 in strdup (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x66cd54) #1 0x36da72f in zif_readline_info /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/readline/readline.c:277:24 #2 0x602518f in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:1421:2 #3 0x5b3f75b in execute_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:115722:12 #4 0x5b41cec in zend_execute /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:121434:2 #5 0x68c4e09 in zend_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1977:3 #6 0x50a195a in php_execute_script_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2640:13 #7 0x50a2a98 in php_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2680:9 #8 0x68d9d1a in do_cli /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:951:5 #9 0x68d40ff in main /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:1362:18 #10 0x7c00a8fdfd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 SUMMARY: AddressSanitizer: 2 byte(s) leaked in 1 allocation(s). ``` To reproduce: ``` ./php-src/sapi/cli/php ./test.php ``` Commit: ``` e23c6222da50a2c5828a03ad701cd3351b13590d ``` Configurations: ``` CC="clang-12" CXX="clang++-12" CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" CXXFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" ./configure --enable-debug --enable-address-sanitizer --enable-undefined-sanitizer --enable-re2c-cgoto --enable-fpm --enable-litespeed --enable-phpdbg-debug --enable-zts --enable-bcmath --enable-calendar --enable-dba --enable-dl-test --enable-exif --enable-ftp --enable-gd --enable-gd-jis-conv --enable-mbstring --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-zend-test --with-zlib --with-bz2 --with-curl --with-enchant --with-gettext --with-gmp --with-mhash --with-ldap --with-libedit --with-readline --with-snmp --with-sodium --with-xsl --with-zip --with-mysqli --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-sqlite3 --with-pdo-sqlite --with-webp --with-jpeg --with-freetype --enable-sigchild --with-readline --with-pcre-jit --with-iconv ``` Operating System: ``` Ubuntu 20.04 Host, Docker 0599jiangyc/flowfusion:latest ``` *This report is automatically generated by [FlowFusion](https://github.com/php/flowfusion)* ### PHP Version ```plain nightly ``` ### Operating System _No response_

« previous php.bugs (#250910) next »