instanceof cannot be called on return value of a function Smarty-3.1.39
this works
{if $object instanceof SomeClass}yes{/if}
This does not (eventhough it used to under php 7.4 and Smarty 3.1.14). Problem occurs with php8.0 and pph7.4
{if get_object() instanceof SomeClass}yes{/if}
workaround is:
{$object = get_object()}
{if $object instanceof SomeClass}yes{/if}
somewhat related to https://github.com/smarty-php/smarty/issues/191
It is bad practice to use application logic in views.
How is get_object() instanceof any more "application logic" than $object instanceof?
The point is: It used to work in smarty 3.1.14 and it does not in 3.1.39. So it is a regression, unless it has been intentionally removed?
instanceof is application logic. Do this check in the controller.
It's a null check. This is pure opinion/style.
We have been using smarty for 18years.
instanceof has worked since v3. It works in 3.1.14 and in 3.1.39
but f() instanceof works only in the former.
Is this an intentional removal of a feature in a minor version change, or is this a regression which you are justifying with an opinion about style?