print_nodeapi() function in print.module has comparison expression

if (($teaser === FALSE) && isset($node->build_mode) && ($node->build_mode == NODE_BUILD_NORMAL))

Take a look at $node->build_mode == NODE_BUILD_NORMAL. This will always evaluate to TRUE if $node->build_mode contains value of type string. NODE_BUILD_NORMAL is zero constant and expression any string == 0 evaluates to TRUE as noted in PHP documentation (see http://www.php.net/manual/en/language.operators.comparison.php).

I've faced this issue with simplenews module which sets $node->build_mode to string value. As a result print module inserts garbage into plain email messages due to incorrect check for NODE_BUILD_NORMAL.

To correct this issue use strict comparison (===) to check for NODE_BUILD_NORMAL:

if (($teaser === FALSE) && isset($node->build_mode) && ($node->build_mode === NODE_BUILD_NORMAL))

Comments

jcnventura’s picture

Status: Active » Fixed

Thanks for the info.. I have just committed a patch with your suggestion to CVS.

Status: Fixed » Closed (fixed)

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