We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

2.0.11: Macro was called without parameter condition

Hello,

After upgrading to 2.0.11 I'm getting the following error: Macro was called without parameter condition

Reverting to 2.0.10 works well.

{%- macro conditionaldate(condition, tdate, ttime, tz) %}{% if condition %} from <br/>{{ tdate }}, {{ ttime }} {{ tz }}{% endif %}{%- endmacro %}

{{ conditionaldate(count_data > 0, tdate, ttime, tz) }}

Looks like it comes from the following change: Fixed Phalcon\Mvc\View\Engine\Volt::callMacro bug. Now it's correctly calling call_user_func_array instead of call_user_func

Any ideas?

Thnx.

Wiesl

edited May '16

Well actually it was done to fix custom user functions, filters etc beacause they weren't working(they weren't passing parameters because call_user_func was executed, they are calling callMacro too, and working right now). I don't know why it broked macros.

Im not sure what has to be done here to make both of them working. You should create an issue on github. You can copy my above explanation why this change was made.

Im not sure you can use it like this. Can you first try to set count_data > 0 to same variable and then call macro with variable ? Also it's weird that it was working on 2.0.10, it shouldn't too, beacause nothing was changed there, I only changed one function which shouldn't have any effect on this.



1.1k

{% set count_data_flag = count_data > 0 %}

{{ conditionaldate(count_data_flag, tdate, ttime, tz) }}

But still the same.



1.1k

I guess it comes from the following change: Fixed Phalcon\Mvc\View\Engine\Volt::callMacro bug. Now it's correctly calling call_user_func_array instead of call_user_func

I think it doesn't.