Bug #77643 [Opn->Asn]: PHP Warning: Can't preload class Zend\Db\Sql\Insert with unresolved constants
| From: | nikic@php.net | Date: | Thu, 21 Feb 2019 09:49:14 +0000 |
| Subject: | Bug #77643 [Opn->Asn]: PHP Warning: Can't preload class Zend\Db\Sql\Insert with unresolved constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219671@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77643&edit=1
ID: 77643
Updated by: nikic@php.net
Reported by: mberchtold at gmail dot com
Summary: PHP Warning: Can't preload class Zend\Db\Sql\Insert
with unresolved constants
-Status: Open
+Status: Assigned
Type: Bug
Package: opcache
Operating System: Windows 10 x64
PHP Version: master-Git-2019-02-21 (snap)
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Here is a minimal repro:
<?php
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.
Previous Comments:
------------------------------------------------------------------------
[2019-02-21 01:19:29] mberchtold at gmail dot com
Description:
------------
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:
---------------
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.preload={PWD}/preload_undef_const_3.inc
preload_undef_const_3.inc:
<?php
$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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77643&edit=1