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
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

dman - July 14, 2007 - 13:29
Status:active» patch (code needs review)

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 enthusiastic foreach( $form

#2

aaron - January 9, 2008 - 18:00
Priority:normal» critical
Assigned to:Anonymous» aaron
Status:patch (code needs review)» patch (reviewed & tested by the community)

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

aaron - January 9, 2008 - 19:19
Status:patch (reviewed & tested by the community)» fixed

committed. thanks for the patch!

#4

Anonymous (not verified) - January 23, 2008 - 19:26
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.