Skip to content

Use of str_starts_with incompatible with PHP 7 #141

@kirk-loretz-fsn

Description

@kirk-loretz-fsn

Version 2.3.2 added a use of str_starts_with via PR #113.

return str_starts_with($path, $key);

str_starts_with requires PHP 8, so the designation of this library as PHP 7.2 compatible is incorrect.

"php": ">=7.2",

Here is a polyfill:

function str_starts_with(string $haystack, string $needle): bool {
    return \strncmp($haystack, $needle, \strlen($needle)) === 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions