fatal error in arrayhelper.php (&more)

Status
Not open for further replies.

Bauer

Well-Known Member
Using Joomla v3.4.1 and recent github update
I was getting this quite often...
Fatal error: Cannot use object of type stdClass as array in /home/compcirc/public_html/components/com_fabrik/helpers/arrayhelper.php on line 328

The error is in
public static function getValue(&$array, $name, $default = null, $type = '')
(which specifically states it was tweaked for Joomla 3.4)

I inserting a dump of $array and $name as the first lines in the function to see what I could come up with.

The problem is that sometimes an object is being passed as $array. Then the fatal error occurs a few lines into the function at the line
if (isset($array[$name]))

The error will occur (in certain situations) on both the front end and admin back end.

A few conditions I've discovered so far that trigger the error...
A form view with a display element that is set with 'Show label' as Yes and with 'Default' value empty.
(Today I found that if I assign a default value to the display element and set Show label to no, then there is no error. But it was working the other way for months prior)
In that case, not only was an object passed as $array but the value passed as $name was an empty string.

When editing elements on the admin backend - E.g. The value of $array is...
object(SimpleXMLElement)#697 (1) { ["@attributes"]=> array(5) { ["name"]=> string(12) "toggle_where" ["type"]=> string(12) "fabrikeditor" ["mode"]=> string(5) "mysql" ["description"]=> string(35) "PLG_ELEMENT_YESNO_TOGGLE_WHERE_DESC" ["label"]=> string(36) "PLG_ELEMENT_YESNO_TOGGLE_WHERE_LABEL" } }

Until this is fixed, I just inserted
if ( !is_array($array) ) return null;
as the first line in the function - though I know that probably is not the correct 'solution'.

I tried updating again today to the latest github update - and things went from bad to worse.
I couldn't even get past login and had nothing but 500 errors - like this one when I logged in...

If difficulties persist, please contact the System Administrator of this site and report the error below.
500 Please specify a valid view type in your fabrik {} code:

All I know is that was in plugins/content/fabrik/fabrik.php (line 890) and is occurring because, using the newest code, $viewName - was never being initialized.
 
the array helper thing should be fixed, along with any layout issues that I could see (my eyes are a bit tired at 2am here though!)
(By the way all layouts should be sending data as objects and not arrays)

For the plugin issue - what view were you trying to load in the {fabrik view=XXXX} content plugin code? I've added in some possible checks into the FabrikWorker::isViewType() method, like lower casing and trimming $view, but perhaps your error is caused from something less obvious.
 
I hadn't really made any additions or changes - just update from github. So it's hard for me to say what caused the 500 error. I'll look into it tomorrow (its late for me now too). Though I have a few appointments and am not sure if I will be able to get to anything until late in the day.

Thanks for the quick reply. I'll let you know if/when I come up with anything that might help shed some light on the subject.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top