php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78514 Preloading segfaults with inherited typed property
Submitted: 2019-09-08 20:02 UTC Modified: 2019-09-09 09:36 UTC
From: kocsismate at woohoolabs dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: 7.4.0RC1 OS: Alpine Linux 3.10
Private report: No CVE-ID: None
 [2019-09-08 20:02 UTC] kocsismate at woohoolabs dot com
Description:
------------
I tried out preloading by generating the preload file for a personal project of mine using my DI container (https://github.com/woohoolabs/zen#generating-a-preload-file).

After some struggle, I got it work, so I managed to preload all the files I wanted with PHP 7.4 beta 1 (via Docker). However, something could happen after some time because preloading stopped working, and I got a segfault on each PHP startup.

I don't know if it is only a coincidence, but the first time I noticed it is around when I introduced property type declarations everywhere in my app and in some of my open-source libraries (which are also preloaded).

Now, that I still have this problem on PHP 7.4 RC1, I thought it's time to report it.

Test script:
---------------
This is the most minimal example I could come up with:
- Download and unzip the following gist: https://gist.github.com/kocsismate/d7f71f5da9e1cefbbdbee040b49c1984
- Run "composer install"
- Run "docker-compose up"



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-09 09:00 UTC] [email protected]
-Status: Open +Status: Verified
 [2019-09-09 09:00 UTC] [email protected]
php: /home/nikic/php-7.4/ext/opcache/zend_persist.c:934: zend_update_parent_ce: Assertion `ce' failed.
 [2019-09-09 09:28 UTC] [email protected]
-Status: Verified +Status: Assigned -Package: Unknown/Other Function +Package: opcache -Assigned To: +Assigned To: nikic
 [2019-09-09 09:28 UTC] [email protected]
I believe what happens here is that a class-typed property is inherited and shared by two classes. We translate the class to SHM when visiting one class and then try to do it again when visiting the second, at which point the xlat lookup fails.
 [2019-09-09 09:36 UTC] [email protected]
-Summary: Preloading segfaults +Summary: Preloading segfaults with inherited typed property
 [2019-09-09 09:37 UTC] [email protected]
-Status: Assigned +Status: Closed
 [2019-09-09 11:51 UTC] kocsismate at woohoolabs dot com
Thank you, Nikita, for your quick response and fix! :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jun 11 02:02:15 2025 UTC