PHP Fatal error: Cannot use object of type stdClass as array in ... i18n_auto/i18n_auto.module on line 175
markfoodyburton - June 21, 2007 - 12:12
| Project: | Auto Translate |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | aaron |
| Status: | closed |
Jump to:
Description
I had a little look, but I didn't solve the problem, sorry :-(
Let me know if you need info to be able to re-produce the bug.
Cheers
Mark.

#1
It's due to an over-eager iteration of the form elements. Quite ugly.
It'll pop up when your node type is a little bit complex, eg, it has a taxonomy selector or other goodness.
Patch this in over top of the old _i18n_auto_form_iterate_for_textareas() function
<?php
/**
* This will return all the (nested) textarea elements in a form.
*/
function _i18n_auto_form_iterate_for_textareas($form) {
static $elements;
if (!isset($elements)) {
$elements = array();
}
foreach (element_children($form) as $element) {
$item = $form[$element];
if ($item['#type'] == 'textarea') {
$elements[$element] = $item;
}
else if (is_array($item)) {
_i18n_auto_form_iterate_for_textareas($item);
}
}
return $elements;
}
?>
It uses the proper
foreach( element_children($form)rather than an enthusiasticforeach( $form#2
thanks, dman! i forgot to subscribe to this issue queue, then got sidetracked, and the module fell to the back burner. i would have finished it months ago if i'd seen your patch.
going to get back to making this module work.
aaron winborn
#3
committed. thanks for the patch!
#4
Automatically closed -- issue fixed for two weeks with no activity.