We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

[fix for] Uncaught TypeError and [] operator not supported for strings | Forum

dave Leader
dave Jul 18 '20

Ran into both of these errors in one of my plugins and so i wanted to share the fix with everyone.

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to OW_ErrorManager::exceptionHandler() must be an instance of Exception, instance of Error given  

Line 235 in ow_core/error_manager.php

Since php 7.1

The fix is just remove the word Exception 

original code       (Exception $e)

new code        ($e)

For the error :  [] operator no supported for strings

It means that since php 7.1 we can no longer just use

$myarray[] = whatever we load it with

it has to be initialized because since php 7.1 php will no longer automatically assign $var[] as an array, you must tell php that it is an array first.

$myarray = array();  or   $myarray = [];

Then you can use it as $myarray[] = whatever we load it with

hope that helps...  

S. Bourdon
S. Bourdon Feb 13 '21
Thanks Dave!
I've been debugging for days since I've updated to php 7...

Little info like this helps a lot.