Skip to content

Function Redeclaration in */functions.php Due to Missing Safety Guards #443

@ghostwriter

Description

@ghostwriter

Hi,

I'm experiencing an issue with a tool that relies on this package.

The problem occurs when the tool tries to include vendor/autoload.php which automatically includes these functions via composer.

amp/composer.json

Lines 48 to 52 in 138801f

"files": [
"src/functions.php",
"src/Future/functions.php",
"src/Internal/functions.php"
]

It results in a "previously declared" function error due to a lack of safety guards to check if the function already exists.

Here is a screenshot illustrating the issue:

image

Suggested Fix:

Add a safety guard to the functions to prevent redeclaration, like:

if (! \function_exists('functionName')) {
    // function definition here
}

Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions