[!!!][BUGFIX] Cast negative int to boolean (true) in BooleanNode 84/26784/9
authorAlexander Schnitzler <alex.schnitzler@typovision.de>
Mon, 13 Jan 2014 13:52:56 +0000 (14:52 +0100)
committerNicole Cordes <typo3@cordes.co>
Sat, 22 Mar 2014 01:19:59 +0000 (02:19 +0100)
commita9e4f2387932b910c15ee341687836d3034906c6
tree3f7ac78a7512eaa562f6f4b25812212bb7773da4
parentd20ecc742c24430aa55657def6e8d9c87fe6b60e
[!!!][BUGFIX] Cast negative int to boolean (true) in BooleanNode

Currently Fluid treats negative integers as false which
results in <f:if condition="-9"> rendering else instead
of then.

When casting integers to boolean using php all integers
other than 0 (zero) are casted to true, just 0 results in
false. Therefore, casting of BooleanNode::convertToBoolean
must be adjusted to act like plain php.

This bugfix is a breaking change as people might have
deliberately used the wrong behaviour.

Releases: 6.2
Resolves: #54243
Resolves: #33597
Change-Id: Iebaa578cf071909610ca0e1abfc9bfaad7459231
Reviewed-on: https://review.typo3.org/26784
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
Reviewed-by: Stefan Neufeind
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/BooleanNode.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/BooleanNodeTest.php