[php-src] Issue #21986: Segfault during `->getContent()` on a `phar` with recursive symlinks

From: Date: Fri, 08 May 2026 16:17:20 +0000
Subject: [php-src] Issue #21986: Segfault during `->getContent()` on a `phar` with recursive symlinks
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252055@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21986 Author: edorian ### Description The following code: ```php <?php $dir = '/tmp/phar_test'; mkdir($dir . '/content', 0777, true); chdir($dir . '/content'); symlink('b.txt', 'a.txt'); symlink('a.txt', 'b.txt'); exec("tar cf $dir/test.tar a.txt b.txt"); $phar = new PharData("$dir/test.tar"); $phar['a.txt']->getContent(); ``` Resulted in this output: ``` [1] 6676 segmentation fault php reproduce.php ``` But I expected this output instead: ``` Some kind of error ``` ### PHP Version ```plain PHP 8.5.6 (cli) (built: May 5 2026 21:19:36) (NTS) Copyright (c) The PHP Group Built by Homebrew Zend Engine v4.5.6, Copyright (c) Zend Technologies with Zend OPcache v8.5.6, Copyright (c), by Zend Technologies ``` ### Operating System macOS

« previous php.bugs (#252055) next »