Bug #77643 [Asn->Csd]: PHP Warning: Can't preload class Zend\Db\Sql\Insert with unresolved constants

From: Date: Thu, 21 Feb 2019 10:01:04 +0000
Subject: Bug #77643 [Asn->Csd]: 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-219672@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:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            opcache
 Operating System:   Windows 10 x64
 PHP Version:        master-Git-2019-02-21 (snap)
 Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6b110b151ddb2eb123407131476aa510b73f54d0
Log: Fixed bug #77643


Previous Comments:
------------------------------------------------------------------------
[2019-02-21 09:49:14] nikic@php.net

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.

------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#219672) next »