Notice: Undefined property: stdClass::$purl in _spaces_taxonomy_term_save_preset_and_modifier() (line 199 of spaces/spaces_taxonomy/spaces_taxonomy.module).

got this once I enabled the module

Comments

mr.baileys’s picture

Status: Active » Needs review
StatusFileSize
new672 bytes

Confirmed with a current version of HEAD. The bug is triggered when Spaces Taxonomy is enabled and a new taxonomy term is created before setting the Spaces taxonomy via Structure > Spaces > Taxonomy.

The bug is caused by the following snippet in _spaces_taxonomy_term_save_preset_and_modifier:

function _spaces_taxonomy_term_save_preset_and_modifier($term) {
  $spaces_taxonomy_machine_name = variable_get('spaces_taxonomy_machine_name', 0);
  if ($term->vocabulary_machine_name == $spaces_taxonomy_machine_name) {
    $space = spaces_load('taxonomy', $term->tid);
    ....

When spaces_taxonomy_machine_name is not set, it defaults to integer 0. Comparing the machine name of the term being saved (always a string, for example 'spaces') with integer zero forces PHP to convert the machine name to a number (String conversion to numbers) prior to comparing. In most cases, this conversion will yield 0, and Spaces Taxonomy will incorrectly treat the term being saved as a spaces term.

Patch attached with an easy fix (don't use a default for 'spaces_taxonomy_machine_name', causing it to be NULL if no vocabulary has been assigned to Spaces Taxonomy).