Information Required ?
avatar brianteeman brianteeman - open - 6 Dec 2019
avatar joomla-cms-bot joomla-cms-bot - change - 6 Dec 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Dec 2019
avatar joomla-cms-bot joomla-cms-bot - edited - 6 Dec 2019
avatar SharkyKZ SharkyKZ - change - 6 Dec 2019
Title
[4.0] array_key_exists is deprecated in php 7.4
array_key_exists() with objects is deprecated in php 7.4
avatar SharkyKZ
SharkyKZ - comment - 6 Dec 2019

Edited title to not be misleading.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27214.

avatar mbabker
mbabker - comment - 6 Dec 2019

array_key_exists() is NOT deprecated, the deprecation is using the function with objects (i.e. something like Joomla\Registry\Registry which implements ArrayAccess meaning you can work with the registry object as an array).

$thing = new Joomla\Registry\Registry;
$thing['foo'] = true;
$thing['bar'] = true;

array_key_exists('foo', $thing); // emits deprecation because an object is being checked

$otherThing = array();
$otherThing['foo'] = true;
$otherThing['bar'] = true;

array_key_exists('foo', $otherThing); // this is OK
avatar brianteeman
brianteeman - comment - 6 Dec 2019

There are instances of using the function with objects

avatar SharkyKZ
SharkyKZ - comment - 6 Dec 2019

It's possible. Could you point to some instances?

avatar Quy Quy - change - 19 Dec 2019
Labels Added: Information Required
avatar Quy Quy - labeled - 19 Dec 2019
avatar brianteeman
brianteeman - comment - 21 Dec 2019

Closing for now - will keep an eye on my error logs

avatar brianteeman brianteeman - change - 21 Dec 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-12-21 14:03:28
Closed_By brianteeman
avatar brianteeman brianteeman - close - 21 Dec 2019
avatar brianteeman brianteeman - change - 10 Jan 2020
Status Closed New
Closed_Date 2019-12-21 14:03:28
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 10 Jan 2020

If you compare two versions of an article you will get the error
Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in \joomla-cms\administrator\components\com_contenthistory\Model\CompareModel.php on line 104

avatar brianteeman brianteeman - reopen - 10 Jan 2020
avatar alikon
alikon - comment - 12 Jan 2020

please test #27493
closing this issue in the hope that all 7.4 compatibilty isuues will have a proper issue

avatar alikon alikon - change - 12 Jan 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-01-12 09:42:53
Closed_By alikon
avatar alikon alikon - close - 12 Jan 2020
avatar laoneo
laoneo - comment - 5 Jun 2020

Please test #29430 as it fixes the same issue on J3 as well.

avatar rahulfromhighwire
rahulfromhighwire - comment - 18 Aug 2022

I have just changed

return array_key_exists($index, $this);
to

return array_key_exists($index, (array) $this);
It is working. I just type cast in Array datatype

Add a Comment

Login with GitHub to post a comment