php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78935 Preloading removes classes that have dependencies
Submitted: 2019-12-09 11:10 UTC Modified: -
From: nikic@php.net Assigned:
Status: Closed Package: opcache
PHP Version: 7.4.0 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nikic@php.net
New email:
PHP Version: OS:

 

 [2019-12-09 11:10 UTC] nikic@php.net
Description:
------------
php -d opcache.preload=preload.php script.php

preload.php:
<?php 
class A {
    const C = UNRESOLVED;
}
class B extends A {
    const C = 42;
}


script.php:
<?php
var_dump(class_exists(A::class));
var_dump((new ReflectionClass(B::class))->getParentClass()->newInstance());

Class A will be removed from the preload state because it has unresolved initializers. However in the meantime B has already been linked, which is preloaded. The end result is that class B has a missing parent class when preloaded.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-10 12:12 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3f86adb0efab3a68d87645941dc997d1e6314050
Log: Fixed bug #78935: Check that all linked classes can be preloaded
 [2019-12-10 12:12 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC