|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79360 Unable to preload constants
Submitted: 2020-03-09 17:58 UTC Modified: -
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: azjezz at protonmail dot com Assigned:
Status: Open Package: opcache
PHP Version: 7.4.3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
24 - 18 = ?
Subscribe to this entry?

 [2020-03-09 17:58 UTC] azjezz at protonmail dot com
Preloading doesn't support constants defined with either `const` or `define`

Test script:
// preload.php

define('FOO', 'foo');

const BAR = 'bar';

class Baz {}

// index.php

var_dump(defined('FOO'), defined('BAR'), class_exists(Baz::class));

Expected result:
bool(true) bool(true) bool(true) 

Actual result:
bool(false) bool(false) bool(true) 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-19 01:33 UTC] thedinosaurmail at gmail dot com
Preloading is implemented as a part of the opcache on top of another (already committed) patch that introduces “immutable” classes and functions.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jul 07 02:05:43 2022 UTC