|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-11-10 22:36 UTC] mails at thomasbley dot de
Description:
------------
php -dopcache.enable_cli=1 psalm --config=psalm.xml.dist --no-cache --threads=8
Scanning files...
Segmentation fault
php -v
PHP 8.1.0RC5 (cli) (built: Nov 4 2021 14:57:53) (NTS)
php -r "echo implode(',', get_loaded_extensions());"
Core,date,libxml,openssl,pcre,zlib,filter,hash,json,pcntl,Reflection,SPL,session,standard,sodium,mysqlnd,PDO,xml,apcu,calendar,ctype,curl,dom,mbstring,FFI,fileinfo,ftp,gettext,iconv,intl,exif,mysqli,pcov,pdo_mysql,Phar,posix,readline,shmop,SimpleXML,soap,sockets,sysvmsg,sysvsem,sysvshm,tokenizer,xmlreader,xmlwriter,xsl,zip,Zend OPcache
Test script:
---------------
error case:
git clone --depth=1 [email protected]:vimeo/psalm.git
cd psalm/
composer install
php -dopcache.enable_cli=1 psalm --config=psalm.xml.dist --no-cache --threads=8
Scanning files...
Segmentation fault
ok case:
php -dopcache.enable_cli=0 psalm --config=psalm.xml.dist --no-cache --threads=8
php -dopcache.enable_cli=1 psalm --config=psalm.xml.dist --no-cache --threads=1
Expected result:
----------------
no segfault
Actual result:
--------------
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jan 29 18:00:01 2026 UTC |
seems this code causes the segfault: ./src/Psalm/Internal/Fork/Pool.php:352 $message = unserialize(base64_decode($serialized_message, true)); data is: O:39:"Psalm\Internal\Fork\ForkTaskDoneMessage":1:{s:4:"data";N;} interface ForkMessage { } class ForkTaskDoneMessage implements ForkMessage { /** @var mixed */ public $data; /** * @param mixed $data */ public function __construct($data) { $this->data = $data; } }Here's a small reproducer: <?php // Create a SHM interned string for FooBar. var_dump("FooBar"); $pid = pcntl_fork(); if ($pid == 0) { // Child: Declare class FooBar {} to allocate CE cache slot. require __DIR__ . '/t480_2.php'; } else if ($pid > 0) { pcntl_wait($status); var_dump(new FooBar); // Crash. } else { echo "pcntl_fork() failed\n"; } t480_2.php: <?php class FooBar {}