Plugin

Archived
Forum
(read-only)

Switchee

ExpressionEngine 1.x, ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4

Back to this add-on's main page
View Other Add-ons From Mark Croxton

     

Default case is returned in addition to matched case

Bug Report

travisb
travisb

Hi Mark, Seeing a change in the way default is working after update to Switchee 2.1 (and ee 2.8.1). If the default case is above the matched case both are being returned. If default is last in order, then it works as expected. For example:

{exp:switchee variable="abc" parse="inward" debug="yes"}
 {case 
default="yes"}default{/case}
 {case value
="abc"}other{/case}
{
/exp:switchee} 

outputs:

defaultother 

Debug shows:
(0.011817 / 5.43MB) Switchee: default case found for variable ‘abc’. This will be returned if no match is found.
(0.011848 / 5.44MB) Switchee: string match: case ‘abc’ matched variable ‘abc’

 

Mark Croxton
# 1
Developer
Mark Croxton

Yes a bug, sorry about that. Fixed now in 2.1.1:

https://github.com/croxton/Switchee

travisb
# 2
travisb

Sweet - thank you!