Download & Extend

Cannot use object of type stdClass as array in subdomain/includes/subdomain_mode_term.inc on line 81

Project:Subdomain
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:rwohleb
Status:needs review

Issue Summary

Using the Subdomain module on D 7.
Using an existing taxonomy inTaxonomy mode.

When adding taxonomy terms to *any* vocabulary I get error:

Fatal error: Cannot use object of type stdClass as array in /<path-to-Drupal/sites/all/modules/subdomain/includes/subdomain_mode_term.inc on line 53

After searching for similar errors I changed line 53

from: if ($form['#vocabulary']['vid'] == variable_get('subdomain_vocab', 0)
to: if ($form['#vocabulary']->vid == variable_get('subdomain_vocab', 0)

I'm unskilled in PHP. The form is an object?

This allows me to add terms to the vocabularies that are *not* associated with the Subdomains module.

Now when I add a term to the specific vocabulary used with Subdomains taxonomy mode, I get a notice from the second part of the condition on the next line:

Notice: Undefined index: delete in subdomain_mode_term->entry_form_alter() (line 54 of /<path-to-Drupal>/sites/all/modules/subdomain/includes/subdomain_mode_term.inc).

Line 54: && !($form['delete']['#type'] == 'value' && $form['delete']['#value'] == TRUE)) {

I've found the 'isset' function, but the meaning and logic of this condition is confusing me.

I've added a line between 53 and 54 as follows:

&& isset($form['delete'])

This removes the notice, but I'm relying on this being evaluated left to right and I guess this is probably incorrect.

Perhaps someone could improve on this?

Comments

#1

I tried some more adding and deleting terms in a Vocabulary and had to make some more changes similar to #1, but I'm stuck on line 78.

Not sure what's an object or how to find out yet.

Recoverable fatal error: Object of class subdomain_mode_term could not be converted to string in subdomain_mode_term->save() (line 78 of /<path>/sites/all/modules/subdomain/includes/subdomain_mode_term.inc).

Does anyone have Subdomains working on D7 in Taxonomy mode?

Is this something specific to my site?

#2

I'm getting the same error. I was able to get it working with a clean install and only one taxonomy vocabulary and item (since subdomain by node type isn't working yet, I created a taxonomy with a single term for "blog") -- but now I can't add additional taxonomy items.

#3

same - sub

#4

+1

#5

Version:7.x-2.0-beta1» 7.x-2.x-dev
Assigned to:Anonymous» rwohleb
Status:active» needs review

This should be fixed in the latest commit (c8def26). Download a new copy of 7.x-2.x and give it a test.

#6

Updated, cleared cache still getting the error

Notice: Undefined index: delete in subdomain_mode_term->entry_form_alter() (line 53 of /var/www/mysite/html/sites/all/modules/subdomain/includes/subdomain_mode_term.inc).

#7

Got the same error here except that I could not edit ANY content types until I disabled the module

#8

Same Problem *PUSH*

#9

The same error with the version 7.x-2.0-beta2:
Notice: Undefined index: delete in subdomain_mode_term->entry_form_alter() (line 53 of /path-to-Drupal/sites/all/modules/subdomain/includes/subdomain_mode_term.inc).

#10

Title:Cannot use object of type stdClass as array subdomain_mode_term.inc on line 53» Cannot use object of type stdClass as array in subdomain/includes/subdomain_mode_term.inc on line 81

Getting the same error. I think the variable has been passed as an array instead of a pointer to a single variable value.

I changed lines 81 and 82 in subdomain_mode_term.inc to the following:

 
if ($obj->vid == variable_get('subdomain_vocab', 0)) {
      return $this->delete_record($obj->tid);

I was able to delete a term from the vocabulary after this change but can anyone else using this change test it and post any problems.

nobody click here