Skip to content

Usage of global constants breaks apps using PHP 7.4s class preloading #20

@spackmat

Description

@spackmat

Hi, I enabled PHP class preloading for my Symfony based app. But when it comes to creating files with TBS/OpenTBS, I get an error "Undefined constant 'TBS_INSTALL'". After digging in, I realized that preloading and global constants defined at runtime with define() won't work together: they are simply not defined when their class is preloaded.

Can anyone confirm that? Any ideas to solve that (besides refactoring the constants-system of TBS/OpenTBS creating a BC break)?

I tried to exclude the (service) class using the TBS_INSTALL constant from preloading, but that doesn't solve the problem (as it and the TBS classes are still preloaded as a dependency).

How to reproduce

Just try to use TBS/OpenTBS in an application with PHP preloading. In opcache_get_status()['preload_statistics']['classes'] you get a list of preloaded classes where clsTinyButStrong, clsTbsDataSource and clsTbsLocator are included, provoking the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions