X Xon Well-known member Oct 4, 2018 #1 Affected version 2.0.10 Code: <xf:if contentcheck="true"> <xf:set var="$test" value="{{ true }}"/> {{ $test ? 'a' : 'b'}} <xf:contentcheck> {{ $test ? 'a' : 'b'}} </xf:contentcheck> </xf:if> This outputs "a b", not the expected "a a"
Code: <xf:if contentcheck="true"> <xf:set var="$test" value="{{ true }}"/> {{ $test ? 'a' : 'b'}} <xf:contentcheck> {{ $test ? 'a' : 'b'}} </xf:contentcheck> </xf:if> This outputs "a b", not the expected "a a"
Chris D XenForo developer Staff member Oct 4, 2018 #2 I don't really feel like that's unexpected, given the purpose of the code. It may be slightly unclear, but we have to evaluate the content within the contentcheck tag first, in order to decide whether the rest of it should be rendered. It essentially looks like this in PHP: PHP: $inner = ($test ? 'a' : 'b'); if (strlen(trim($inner)) > 0) { $test = true; $finalOutput .= ($test ? 'a' : 'b') ; $finalOutput .= $inner; } Given this output, there isn't really a way to fix this, so it's a design issue, really.
I don't really feel like that's unexpected, given the purpose of the code. It may be slightly unclear, but we have to evaluate the content within the contentcheck tag first, in order to decide whether the rest of it should be rendered. It essentially looks like this in PHP: PHP: $inner = ($test ? 'a' : 'b'); if (strlen(trim($inner)) > 0) { $test = true; $finalOutput .= ($test ? 'a' : 'b') ; $finalOutput .= $inner; } Given this output, there isn't really a way to fix this, so it's a design issue, really.