Bug #77644 [Opn]: [preload] Uncaught Error: Undefined constant
| From: | nikic@php.net | Date: | Thu, 21 Feb 2019 09:08:47 +0000 |
| Subject: | Bug #77644 [Opn]: [preload] Uncaught Error: Undefined constant | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219668@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77644&edit=1
ID: 77644
Updated by: nikic@php.net
Reported by: mberchtold at gmail dot com
Summary: [preload] Uncaught Error: Undefined constant
Status: Open
Type: Bug
Package: opcache
Operating System: Windows 10 x64
PHP Version: master-Git-2019-02-21 (snap)
-Assigned To:
+Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
I believe that constants are not preloaded intentionally. @dmitry: Can you explain why constants
cannot be preloaded?
Previous Comments:
------------------------------------------------------------------------
[2019-02-21 01:44:02] mberchtold at gmail dot com
Description:
------------
When a class that uses a constant with a namespace prefix is preloaded, using the class results in a
fatal error.
Test script:
---------------
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.preload={PWD}/preload_undef_const_4.inc
preload_undef_const_4.inc:
<?php
namespace mytest;
define(__NAMESPACE__ . '\CONSTANTINE', 'value');
class Test
{
public function __construct()
{
echo CONSTANTINE;
}
}
--FILE--
<?php
new \mytest\Test();
Expected result:
----------------
no error
Actual result:
--------------
PHP Fatal error: Uncaught Error: Undefined constant
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77644&edit=1