Skip to content

array_key_exists deprecated in PHP7.4 #24

@marcos-guerrero

Description

@marcos-guerrero

Hi!
We are testing PHP7.4 and there's a deprecated feature:
https://www.php.net/manual/es/migration74.deprecated.php#migration74.deprecated.core.array-key-exists-objects

So, in our system, the line https://github.com/austinhyde/IniParser/blob/master/src/IniParser.php#L197 is throwing this error:

Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in C:\inetpub\wwwroot\intranet\3rdparty\IniParser\vendor\austinhyde\iniparser\src\IniParser.php on line 197

Our idea, to fix it without too much research would be to implement a private method:

private static function array_key_exists($key_or_property, $array_or_class) { return is_object($array_or_class) ? property_exists($array_or_class, $key_or_property) : array_key_exists($key_or_property, $array_or_class); }

and replace all the array_key_exists calls for self::array_key_exists

Thank you very much in advance for your help!

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