Created
January 3, 2022 21:42
-
-
Save sarim/e8f8b5bb2b3263c5c2e7d68d31bb2f3c to your computer and use it in GitHub Desktop.
SEGFAULT with symfony cache + http-client in php8.1+symfony6. Works fine in php7.4/symfony5.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// composer require symfony/cache | |
// composer require symfony/http-client | |
// rm -rf /tmp/symfony-cache/ | |
// php main.php | |
use Symfony\Component\Cache\Adapter\FilesystemAdapter; | |
use Symfony\Component\HttpClient\NativeHttpClient; | |
use Symfony\Component\HttpClient\ScopingHttpClient; | |
use Symfony\Contracts\Cache\ItemInterface; | |
require 'vendor/autoload.php'; | |
$cache = new FilesystemAdapter(); | |
// Tried with both Curl and Native client, same crash. | |
$client = new NativeHttpClient(); | |
$apiClient = ScopingHttpClient::forBaseUri($client, 'https://xkcd.com'); | |
$comicId = '0'; | |
$infos = $cache->get('comic_'.$comicId, function (ItemInterface $item) use ($comicId, $apiClient) { | |
$response = $apiClient->request('GET', "/info.{$comicId}.json"); | |
return $response->toArray(); | |
}); | |
\print_r($infos); | |
echo "Success\n"; |
Crashes here
Program received signal SIGSEGV, Segmentation fault.
0x000055555574bd3d in zend_closure_get_debug_info (object=0x7ffff3a99300, is_temp=<optimized out>)
at /usr/src/debug/php-8.1.1-1.el8.remi.x86_64/Zend/zend_closures.c:562
562 array_init(&val);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GDB