Try previewing a post with some free tagging taxonomy terms added:

    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 48.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 49.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 74.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 75.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 75.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 78.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 51.
    * notice: Trying to get property of non-object in drupal6/modules/taxonomy/taxonomy.module on line 1133.

These are all $term->tid $term->name which are all over the place in drupal so bad commit maybe?

Comments

marcingy’s picture

Also affects none free tagged taxonomys

notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 449.

When the preview page is returned the term is not set.

marcingy’s picture

Once the node is saved and preview is selected a different set of errors is generated:

notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 48.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 49.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 74.
notice: Undefined index: in D:\drupal6\modules\taxonomy\taxonomy.module on line 868.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 75.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 75.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 78.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 51.
notice: Trying to get property of non-object in D:\drupal6\modules\taxonomy\taxonomy.module on line 449.

JirkaRybka’s picture

This set also occurs without free tagging - just make the vocabulary not required, and select no term.

marcingy’s picture

The free tagging issues are caused because

// Free tagging vocabularies do not send their tids in the form,
// so we'll detect them here and process them independently.

Therefore a term is never loaded hence the reason why the links aren't displayed - I'm guessing that it is a similar issue when the value is not to none for standard tags.
Errors on lines 48,49,74,75 and 78 are caused by this.

Also for the issue on line 449 the object node->taxonomy hasn't be correctly innitalised.

robloach’s picture

Subscribing after encountering something similar.

cburschka’s picture

Assigned: Unassigned » cburschka
Status: Active » Needs review
StatusFileSize
new1.88 KB

All of these can be fixed in the obvious way, by adding an is_object() condition to the parts of the code that trigger the notice. This does not change the behavior of the code, but works for E_ALL compliance.

After applying this patch on my test site, taxonomy.module no longer triggered notices on previewing or saving a node with freetagging vocabulary fields.

----

However, there is a part to this issue where a different behavior may be desired. Namely, when a node is previewed, its free-tagged vocabulary is not displayed at all. Changing this would be more of a feature, but the suggestion could well be placed here:

Alternatively, we may generate "pseudo-links" that show these keywords (but do not lead anywhere). But this can potentially confuse users who try to click on the links.

Or, and this takes most effort, we can do a preliminary match on the terms entered and generate fully-qualified links for those (but not add new terms to the database yet). This option still leaves open whether new terms should have pseudo-links or stay invisible.

marcingy’s picture

Priority: Normal » Critical

Also it appears as if an empty taxonomy is also being apended to a node.

I have a node with a single term associated with it. When I call taxonomy_node_get_terms the following array is returned

Array ( [1] => Array ( [tid] => Array ( [5] => stdClass Object ( [tid] => 5 [vid] => 1 [name] => food [description] => [weight] => 0 ) ) ) ) Array ( [1] => Array ( [tid] => Array ( [5] => stdClass Object ( [tid] => 5 [vid] => 1 [name] => food [description] => [weight] => 0 ) ) ) [] => Array ( [tid] => Array ( ) ) )

Note the empty tid at the end.

In addition the following errors are thrown

notice: Trying to get property of non-object in D:\or6\modules\taxonomy\taxonomy.module on line 491.
notice: Trying to get property of non-object in D:\or6\modules\taxonomy\taxonomy.module on line 492.
notice: Trying to get property of non-object in D:\or6\modules\taxonomy\taxonomy.module on line 493.
notice: Trying to get property of non-object in D:\or6\modules\taxonomy\taxonomy.module on line 500.

The node is simply being viewed and is otherwise valid

desbeers’s picture

Status: Needs review » Closed (duplicate)

http://drupal.org/node/163728 deals with the notices and a lot more like lost of free-tags and resetting to default of other tags on preview. I mark this as duplicate.