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

Volt - adding block in page header results in exit signal Segmentation fault (11)

Hello.

I experienced a strange behavior. If i try to add a block in a page "header", the extension crashes, and in the logs, i can see "...exit signal Segmentation fault (11)"

Example:

<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8"> <title>Ti</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="[email protected]">

{{ stylesheet_link('assets/admin/default/css/bootstrap.css') }} {{ stylesheet_link('assets/admin/default/css/styles.css') }} {{ stylesheet_link('assets/admin/default/css/bootstrap-responsive.css') }} {{ stylesheet_link('assets/admin/default/css/themes.css') }}

If i try to add {% block your_block_name %}Block content{% endblock %} , anywhere before {{ stylesheet_link('assets/admin/default/css/bootstrap.css') }} , the extension will crash.

Any known issues about this ? Any help would be appreciated. Than you.

Phalcon 1.1.0



98.9k

Can you try with 1.2.0? maybe the problem is not related to Volt but it's a bug in Phalcon\Escaper in 1.1.0



51.2k

Hello. With 1.2.0 i can't put any {% block %} before </head>. It fails with the same error. If it helps you, i was testing with php 5.4.15 and 5.4.17RC1 on apache, ubuntu 12.04



51.2k

Hi,

I have made a pull now in 1.2.0 and reinstalled phalcon. It seems that this problems is fixed. This are the files with changes:

Updating fb9a6d0..48a06c3 Fast-forward build/32bits/phalcon.c | 4605 +++++++++++++++++-------------- build/32bits/phalcon.h | 6 + build/64bits/phalcon.c | 4969 +++++++++++++++++++--------------- build/64bits/phalcon.h | 6 + build/safe/phalcon.c | 4605 +++++++++++++++++-------------- build/safe/phalcon.h | 6 + ext/acl/adapter/memory.c | 4 +- ext/assets/collection.c | 8 +- ext/cache/frontend/base64.c | 52 +- ext/config.c | 87 +- ext/crypt.c | 213 +- ext/db/adapter/pdo.c | 2 +- ext/db/dialect.c | 2 +- ext/db/dialect/oracle.c | 6 +- ext/debug.c | 2 +- ext/escaper.c | 31 +- ext/filter.c | 14 +- ext/http/response.c | 2 +- ext/kernel/array.c | 31 + ext/kernel/array.h | 3 + ext/kernel/exception.c | 12 +- ext/kernel/exception.h | 2 +- ext/kernel/operators.c | 3 + ext/kernel/string.c | 81 +- ext/kernel/string.h | 7 + ext/mvc/collection.c | 4 +- ext/mvc/model.c | 2 +- ext/mvc/model/metadata.c | 20 +- ext/mvc/model/query.c | 2 +- ext/mvc/model/resultset.c | 2 +- ext/mvc/router/route.c | 2 +- ext/mvc/view.c | 25 +- ext/mvc/view/engine/volt/compiler.c | 7 +- ext/paginator/adapter/model.c | 15 +- ext/paginator/adapter/nativearray.c | 2 +- ext/paginator/adapter/querybuilder.c | 4 +- ext/phalcon.c | 10 +- ext/security.c | 57 +- ext/text.c | 8 +- ext/validation/message/group.c | 51 +- ext/version.c | 3 +- unit-tests/ConfigTest.php | 38 + unit-tests/TagTest.php | 74 + unit-tests/ValidationTest.php | 39 +- 44 files changed, 8478 insertions(+), 6646 deletions(-) mode change 100755 => 100644 unit-tests/ConfigTest.php create mode 100644 unit-tests/TagTest.php



51.2k

It seems that it is still failing, but for other html section:

        {% for user in users %}
        <tr>
          <td> {{ user.id }} </td>
          <td> {{ user.username }} </td>
        </tr>
        {% endfor %}

If i put the FOR before <table> it works. Like: {% for ... %}<table><tr><td>...</table>{% endfor %}



51.2k

Also, if i generate get and set methods for models and i try to access them in volt ( {{ object.getMethodName() }} ), it throws an error - Access to undefined property Object::getMethodName



51.2k

Update: If i am restarting apache, the first request, renders the page correctly. All the other requests, are failing : "...exit signal Segmentation fault (11)"



98.9k

@Calin: Can you please post a full test in a Gist (https://gist.github.com/)?

Follow this example: https://gist.github.com/phalcon/5901789

To properly diagnose the problem, we need a complete script to be able to reproduce the bug ourselves.



51.2k

@Phalcon , please check https://gist.github.com/calinrada/5901923 . I you need anything else, please let me know. Cheers !



98.9k

I uploaded your code to https://github.com/phalcon/mvc/tree/master/calinrada

It's running here: https://test.phalcon.io/calinrada/article

Please tell me what to change in the code to see the problem



51.2k

Well, this is the code that is not working for me. So in this case ... ? Maybe it's about apache / APC ? Since the first request after i restart apache is outputing the correct template without errors ?



98.9k

We fixed a bug in Volt today that is perhaps related, can you try again compiling from the 1.2.0 branch?



51.2k
Accepted
answer

It is working ! Nice ! Thank you very much. If you don't mind, can you tell me in a big view what was all about ? Just curios. Thank you ;}



98.9k

Long story, it started here: https://github.com/phalcon/cphalcon/pull/745#issuecomment-20255741, it seems it was an uninitialized variable in a recent commit.