In node.module, <p> tags are returned as help text, even when there's no body to the text, creating empty <p> tags in the html output on the node/add pages. I tracked this down to the node_help function (line 42 in node.module).

Comments

simmerz’s picture

StatusFileSize
new437 bytes

I've just fixed this bug. was a simple addition of an if() statement to check for content, and if not, it will return false, and therefore not print out anything at all.

simmerz’s picture

Version: 5.0 » 5.1

The above is a patch for 5.1 btw

pfaocle’s picture

Status: Active » Needs review
StatusFileSize
new640 bytes

Confirming this - just took me a while to hunt down as our styled #help divs were being shown even when empty. Its down to this snippet always returning the <p></p> tags.

Slighty amended patch, avoiding calling filter_xss_admin() twice.

drumm’s picture

Status: Needs review » Needs work

Always use explicit checks instead of casting to boolean, for example, !empty($type->help). And we do not need to filter_xss() before checking if it exists or not.

desbeers’s picture

Version: 5.1 » 6.x-dev
Status: Needs work » Needs review
StatusFileSize
new990 bytes

Problem also exist in 6.0

Attached a patch for 6 that uses !empty($type->help). Note that isset(), as used before, is not working because $type->help is always set, but sometimes empty.

Fixes empty p's at node/*/add and node/*/edit.

desbeers’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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