|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77643 PHP Warning: Can't preload class Zend\Db\Sql\Insert with unresolved constants
Submitted: 2019-02-21 01:19 UTC Modified: 2019-02-21 09:49 UTC
From: mberchtold at gmail dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: master-Git-2019-02-21 (snap) OS: Windows 10 x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mberchtold at gmail dot com
New email:
PHP Version: OS:


 [2019-02-21 01:19 UTC] mberchtold at gmail dot com
I'm trying to preload zend framework 3. A lot of the following warnings are reported and the class is not preloaded:
PHP Warning:  Can't preload class Zend\Db\Sql\Insert with unresolved constants

When I inspect the Zend\Db\Insert class, there are no undefined constants. 
Preloading only the file itself does not issue any warnings, only after all the dependent classes are preloaded.

I could not figure out a minimal reproducible example, other than preloading some files from zend\db.

Test script:

$basedirectory = 'C:/test/';
// dependent classes
opcache_compile_file($basedirectory . 'vendor/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php');
opcache_compile_file($basedirectory . 'vendor/zendframework/zend-db/src/Sql/SqlInterface.php');
opcache_compile_file($basedirectory . 'vendor/zendframework/zend-db/src/Sql/AbstractSql.php');
opcache_compile_file($basedirectory . 'vendor/zendframework/zend-db/src/Sql/PreparableSqlInterface.php');
opcache_compile_file($basedirectory . 'vendor/zendframework/zend-db/src/Sql/AbstractPreparableSql.php');
// actual class
opcache_compile_file($basedirectory . 'vendor/zendframework/zend-db/src/Sql/Insert.php');

Expected result:
No warning

Actual result:
PHP Warning:  Can't preload class Zend\Db\Sql\Insert with unresolved constants


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-21 09:49 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: nikic
 [2019-02-21 09:49 UTC]
Here is a minimal repro:

class Foo {
    protected $prop;

class Bar extends Foo {
    protected $prop = self::FOOBAR;
    const FOOBAR = 42;

The problem is that the constant is resolved against the wrong class, because we're reusing a property slot from the parent.
 [2019-02-21 10:01 UTC]
Automatic comment on behalf of
Log: Fixed bug #77643
 [2019-02-21 10:01 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 22 19:01:25 2023 UTC