Bug #79548 [NEW]: Segfault when using static inline variable inside a trait
| From: | luca at sungazer dot io | Date: | Thu, 30 Apr 2020 15:33:49 +0000 |
| Subject: | Bug #79548 [NEW]: Segfault when using static inline variable inside a trait | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-226855@lists.php.net to get a copy of this message | ||
From: luca at sungazer dot io
Operating system: Linux
PHP version: 7.4.5
Package: opcache
Bug Type: Bug
Bug description:Segfault when using static inline variable inside a trait
Description:
------------
Configuration:
* Custom image built from https://hub.docker.com/_/php
* Nginx + PHP-FPM
* Symfony 5.0.8
* PHP 7.4.5
* Preloading enabled (preload file generated by Symfony)
Description:
When using the Symfony Cache component, php-fpm was terminating with
SIGSEGV whenever I wanted to call the cache get() method. This happened
only when preloading was enabled.
After further investigation, I saw that the segmentation fault happens
at this line of Symfony's ContractsTrait
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Cache/Traits/ContractsTrait.php#L58
i.e. at the declaration of a static variable inside a private method of
a Trait.
A similar issue was reported on Symfony's issue list as well:
https://github.com/symfony/symfony/issues/36328
As a workaround, I tried moving the declaration outside the function
(i.e. at trait level
private static $setMetadata) and then code
started working as intended. Disabling preloading also fixes the issue.
Test script:
---------------
Please see the following repository:
https://github.com/luca-nardelli/symfony-cache-segfault-reproducer/tree/master
--
Edit bug report at https://bugs.php.net/bug.php?id=79548&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79548&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79548&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79548&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79548&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79548&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79548&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79548&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79548&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79548&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79548&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79548&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79548&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79548&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79548&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79548&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79548&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79548&r=mysqlcfg