Closed (fixed)
Project:
Printer, email and PDF versions
Version:
6.x-1.10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 May 2010 at 22:17 UTC
Updated:
27 Jul 2010 at 12:30 UTC
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
Comment #1
jcnventuraThanks for the info.. I have just committed a patch with your suggestion to CVS.