Bug #79043 [Com]: Segmentation fault when using preloading

From: Date: Tue, 23 May 2023 06:46:17 +0000
Subject: Bug #79043 [Com]: Segmentation fault when using preloading
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244509@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79043&edit=1

 ID:                 79043
 Comment by:         autocarbikenews at gmail dot com
 Reported by:        benjamin dot morel at gmail dot com
 Summary:            Segmentation fault when using preloading
 Status:             Open
 Type:               Bug
 Package:            opcache
 Operating System:   CentOS 7.7
 PHP Version:        7.4.2
 Block user comment: N
 Private report:     N

 New Comment:

Auto Car Bike News are sharing latest news about auto, car, bikes, upcoming car and bikes news,
electric vehicle news etc. More info to visit: (https://autocarbikenews.com)github.com


Previous Comments:
------------------------------------------------------------------------
[2020-04-21 21:29:52] benjamin dot morel at gmail dot com

Looks like this is due to this oddity in Doctrine/Persistence:

https://github.com/doctrine/persistence/blob/1.3.7/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php

https://github.com/doctrine/persistence/blob/1.3.7/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php

Passing an instance of AnnotationDriver where an instance of MappingDriver is expected works at
runtime because of the class_alias(), but fails static analysis that uses the declaration inside the
if(false) condition (PHPStorm warns about it as well).

Therefore I'm not sure whether the behaviour of the preloader is a bug:
**Should it preload the interface/class declarations, even though they're conditional?**

------------------------------------------------------------------------
[2020-04-16 15:00:56] benjamin dot morel at gmail dot com

Same issue with PHP 7.4.5.

------------------------------------------------------------------------
[2020-03-18 17:37:59] benjamin dot morel at gmail dot com

Same error in PHP 7.4.4:

TypeError: Argument 1 passed to Doctrine\ORM\Configuration::setMetadataDriverImpl() must be an
instance of Doctrine\Common\Persistence\Mapping\Driver\MappingDriver, instance of
Doctrine\ORM\Mapping\Driver\AnnotationDriver given

------------------------------------------------------------------------
[2020-02-18 23:09:26] nikic@php.net

Just to be clear, those warnings are fine and expected if you use opcache_compile_file() to preload.
In that mode it will preload everything it can, and warn about the things it can't. You can use
"require" to preload if you want to avoid the warnings. This will fatal error if
everything can't be preloaded -- but it is capable of preloading a larger set of cases.

The TypeError you mention shouldn't occur though.

------------------------------------------------------------------------
[2020-02-18 22:34:37] benjamin dot morel at gmail dot com

Same issue with PHP 7.4.3.

The log is flooded with warnings:

(...)
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\Persistence\Event\OnClearEventArgs: Unknown reason in /home/nicebooks/nicebo
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\Persistence\Event\ManagerEventArgs: Unknown reason in /home/nicebooks/nicebo
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs: Unknown reason in /home/nicebo
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\Persistence\Event\LifecycleEventArgs: Unknown reason in /home/nicebooks/nice
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\Persistence\ConnectionRegistry: Unknown reason in /home/nicebooks/nicebooks.
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\Persistence\AbstractManagerRegistry: Unknown reason in /home/nicebooks/niceb
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Doctrine\Common\NotifyPropertyChanged: Unknown reason in /home/nicebooks/nicebooks.com/relea
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class Brick\Unit\TestCase: Unknown
parent PHPUnit\Framework\TestCase in /home/nicebooks/nicebooks.
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Tests\Currency\LocaleTest: Unknown parent PHPUnit\Framework\TestCase in /home/nicebook
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Tests\Currency\LanguageTest: Unknown parent PHPUnit\Framework\TestCase in /home/nicebo
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Tests\Currency\CountryTest: Unknown parent PHPUnit\Framework\TestCase in /home/niceboo
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Tests\Random\RandomPickerTest: Unknown parent PHPUnit\Framework\TestCase in /home/nice
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class Brick\Money\RationalMoney:
Unknown type dependencies in /home/nicebooks/nicebooks.com/releas
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class Brick\Money\Money: Unknown type
dependencies in /home/nicebooks/nicebooks.com/releases/15820
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Money\Context\DefaultContext: Unknown type dependencies in /home/nicebooks/nicebooks.c
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Money\Context\CustomContext: Unknown type dependencies in /home/nicebooks/nicebooks.co
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Money\Context\CashContext: Unknown type dependencies in /home/nicebooks/nicebooks.com/
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class
Brick\Money\Context\AutoContext: Unknown type dependencies in /home/nicebooks/nicebooks.com/
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class Brick\Math\BigRational: Unknown
type dependencies in /home/nicebooks/nicebooks.com/releases/
NOTICE: PHP message: PHP Warning:  Can't preload unlinked class Brick\Math\BigInteger: Unknown
type dependencies in /home/nicebooks/nicebooks.com/releases/1

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79043


--
Edit this bug report at https://bugs.php.net/bug.php?id=79043&edit=1


Thread (19 messages)

« previous php.bugs (#244509) next »