Set theme to chameleon or marvin, create a node with empty body promoted to front page, then visit the front page:

notice: Undefined property: stdClass::$body in /var/www/drupal-cvs/local/themes/chameleon/chameleon.theme on line 128.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

If the body is empty, it will not be set? Are you sure?

John Morahan’s picture

Title: chameleon notice with empty node body » PHP notices with chameleon theme
Assigned: Unassigned » John Morahan
Status: Needs review » Needs work

Well, if it's empty, then concatenating it to $output is harmless. The real problem here is in the teaser view, where the body is always unset. If $node->teaser is set but empty, the if will fail and try to display the unset $node->body instead.

A similar isset($node->body) fix is used in template_preprocess_node.

Setting to CNW because of http://drupal.org/node/176078#comment-306220 - will look at this later.

Gábor Hojtsy’s picture

Oh, yes, agreed.

John Morahan’s picture

Status: Needs work » Needs review
FileSize
821 bytes

Here's a combined patch.

Freso’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
820 bytes

gentoo-vm drupal6 # patch -p0 < chameleon-isset_1.patch
patching file themes/chameleon/chameleon.theme

I can reproduce the bug on a clean D6 install from CVS. Applying the patch fixes the problem, and I can't identify anything that should break.

I don't know whether there are any performance difference doing else if vs. elseif, though I seem to have it implied somewhere in a discussion regarding the use of case. Either way, elseif is used in the Coding standards, and else if isn't, so I've attached a patch identical John Morahan's latest, except with the else if replaced by an elseif.

Either this or the original patch is RTBC.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)