• Hi,
    I have updated my website to wordpress 5.9.2 and PHP 8.0, and then got a fatal error as:
    Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /xxx/wp-content/plugins/memphis-documents-library/includes/mdocs-show-file-info-templates.php:144

    Is there any possible solution to solve the problem? I will appreciate for your help.

    Best regards
    Wen

Viewing 3 replies - 1 through 3 (of 3 total)
  • This plugin will not work with PHP 8.0 until it gets a rewrite. The developer abandoned the plugin well over a year ago and has indicated he will no longer be maintaining it.

    My suggestion is to start looking for an alternate plugin. Sorry. I am dealing with this issue as well and moving at least 100 websites to other document library solutions.

    I would like to add however, that the error above is not so difficult to correct. The problem is that array_key_exists() is sometimes called with a boolean as second parameter instead of an array. It was a problem in PHP 7.x as well, just there it could be masked with the @ symbol.

    Prior to PHP 8.0.0, it was possible for the @ operator to disable critical errors that will terminate script execution. For example, prepending @ to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why.

    This is the code line:
    if(@!array_key_exists($key, $file_info) && $is_update == false )

    $file_info is a boolean (false) when the preceding option reading is unsuccessful, as the get_option has a return value type of mixed. An easy solution is to check the return value in $file_info before calling array_key_exists function.

    Complete code refactoring would certainly help, probably improve performance, would enable future development, would bring easier maintenance, etc. But if you just need to get the current code to start/work with PHP 8 it is possible with a few corrections, like the one described above.

    Hello,
    @cameronbarrett can you tell us what document library solution you are using now?
    I have a lot of trouble to find a solution that match mdocs…

    Thanks a lot

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal Error WordPress WP 5.9.2 PHP 8.0’ is closed to new replies.