-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing an object to Volt macro; "PHP Fatal error: Cannot use object of type stdClass as array" #11771
Comments
It's fixed in current 2.0.x repo. |
Thanks @Jurigag will take a look at it |
@ilgityildirim Hello. Could you pease check two vesions. Current Phalcon's master branch (2.0.11) and my PR #11765. It seems there is two ways to fix it |
@sergeyklay #11765 didn't fix the issue however 2.0.10 fixed it. Seems the best option is to downgrade for the moment. |
So issue related to the v2.0.11 or v2.0.10? |
@sergeyklay issue is related to v2.0.11 |
I have the same issue on v2.0.11 |
Did you tried this #11765 ? |
Yes but doesn't work. Also i've upgraded to 2.1.x and it works and there's with call_user_func_array ( https://github.com/phalcon/cphalcon/blob/2.1.x/phalcon/mvc/view/engine/volt.zep#L293 ) but 2.0.x breaks other things like validators so for now i can't make the upgrade |
What. You mean in 2.1.x with call_user_func_array it works fine ? Then i don't know what's going on. |
Yeah, as you can in see :( Also I changed manualy in volt.zep, recompiled and problem still exists :( |
Well, @ilgityildirim @vikilaboy @Jurigag I'm totally confused 😄
What option doesn't work? |
2.0.10 works well. 2.1.x also :) |
What ? How the hell 2.1.x works if it's second case which @sergeyklay wrote. Then i would understand why i got some problems with functions/filters i guess maybe. You are checking 2.1.x with php 5 or php 7 ? |
PHP 5.6.20-1~dotdeb+zts+7.1 (cli) (built: Apr 1 2016 04:20:28) |
Anyway I switched back to 2.0.10 until this will be fixed. I'll also try to fix this.. |
@vikilaboy Could you please check #11765? Just clone my repo and compile Phacon from 2.0.x branch |
Checked out to branch 2.0.x, compile and the result is with the same issue. Am I doing something wrong ? |
No. You need to clone @sergeyklay repo 2.0.x It's not merged YET. |
I'm getting the same problem :(. {%- macro formRow(form, tag, attributes = '', col = 6) %}
{% set defaultClass = 'form-control ' %}
{% if attributes is iterable %}
{% for key, value in attributes %}
{% set attr[key] = value %}
{% endfor %}
{% else %}
{% set attr['class'] = defaultClass ~ attributes %}
{% endif %}
<div class="form-group">
<label class="col-sm-2 control-label" for="{{ tag }}">{{ form.getLabel(tag) }}:</label>
<div class="col-sm-{{ col }}">
{{ form.render(tag, attr) }}
</div>
</div>
{%- endmacro %} and is called like this {{ formRow(formLogin, 'password') }} where formLogin is the form object and 'password' is tag key |
Did you cloned right repo ? |
https://github.com/sergeyklay/cphalcon.git - compiled also on branch master and 2.0.x |
Okay. I'll try to sort out today |
@vikilaboy @ilgityildirim |
I updated my server yesterday evening. Today morning I realized I haven't gotten any visitor since yesterday evening. I decided to visit my site and I found it unable to display the pages.
There is a problem with Volt's macro feature after an update.
Volt code
Generated PHP code
This code generates following error;
If you're like me, added listing etc. via macros, there is chance you will experience the same issue (unless I'm guessing you use arrays instead of objects, not that I have tried it though).
Just wanted to leave it here and hoping for a fix with next version. I'll be down-grading Phalcon now.
The text was updated successfully, but these errors were encountered: