Valc / jmlocalise

GNU General Public License v2.0
3 stars 2 forks source link

0 array_key_exists(): Argument #2 ($array) must be of type array, bool given #1

Closed fontanil closed 2 years ago

fontanil commented 2 years ago

Hi, Thanks for that component I'm using sometimes! I used the RC3 version on a site using PHP 8.1 (or 8.0) and got this error on the translations page. JROOT/administrator/components/com_localise/Model/TranslationModel.php:947 No error with PHP 7.4

Valc commented 2 years ago

@fontanil The current and recommended Thechnical requirements for Joomla 4 are at PHP 8.0

https://downloads.joomla.org/technical-requirements

And is suggested follow them.

You can try to edit the file: .../administrator/components/com_localise/Model/TranslationModel.php

and replace the line 947:

elseif (!array_key_exists($key, $sections['keys']))

with:

elseif (!isset($sections['keys'][$key]))

But surely more issues due you are using PHP 8.1 and not PHP 8.0 will be displayed.

If the issue is that using PHP 8.0 you are missing "untranslated keys" then this one need to be hanled as bug.

fontanil commented 2 years ago

Thanks Valc! I don't understand why I also got the error in PHP 8.0, it doesn't appear anymore (before change). I modified this line and I no longer get the error in 8.1

Valc commented 2 years ago

Closing the issue. Thank you.