In a switch statement: Even when you do NOT choose 'Fall through', every case gets evaluated (and executed, if it's true) no matter what. There aren't any breaks.

Here's an example of a rule I created in the GUI and exported:
Note: I used two 'case: 1' so that I could see if the action was executed for each case. It was. When the cases are different, the 2nd case still gets evaluated, which it shouldn't if the first case is true. There should be a break if no Fall through is chosen.

{ "rules_gp_testing_break_in_rules" : {
"LABEL" : "GP Testing Break in rules",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules_conditional", "rules" ],
"ON" : { "node_view--page" : { "bundle" : "page" } },
"DO" : [
{ "SWITCH" : {
"USING" : { "data" : [ "node:nid" ] },
"DO" : [
{ "CASE" : {
"USING" : { "value" : "1" },
"DO" : [ { "drupal_message" : { "message" : "hi - case 1 executed" } } ]
}
},
{ "CASE" : {
"USING" : { "value" : "1" },
"DO" : [
{ "drupal_message" : { "message" : "This is the second case 1. It shouldn\u0027t get executed because there\u0027s no fall through chosen. Where\u0027s the break? " } }
]
}
}
]
}
}
]
}
}

Comments

gparsloe’s picture

Issue summary: View changes
echoz’s picture

alansaviolobo’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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