Skip to content

Fatal error: Cannot declare class Composer\InstalledVersions, because the name is already in use #991

@llaville

Description

@llaville

Bug report

Question Answer
Box version 4.3.8@5534406
PHP version 8.1.18
Platform with version Ubuntu 22.04 LTS
Github Repo -

When reusing BOX in a Composer Plugin context, PHP raise this fatal error when getting box version with \KevinGH\Box\get_box_version.

To avoid this error, I suggest to fix current get_box_version by this

if (!class_exists(InstalledVersions::class, false) && file_exists($file)) {

instead of https://github.com/box-project/box/blob/4.3.8/src/functions.php#L59

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions