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

When use custom functions in Volt template it crash php process

Why didn't you provide error log before? And maybe you can show some functions? Have you checked file names? Cauze UNIX systems are case sensitive!!

this is what I added to php

$compiler = $volt->getCompiler();
$compiler->addFunction(
    'last',
    function ($resolvedArgs) use ($compiler) {
        return 'array_pop('. $resolvedArgs .')';
    }
);

And use it in volt templates like

{% set laseImage = last(data['media'][data['media']['order']['0']]['details']) %}

but it does not matter, which function I add and use. If it is custom - it crashes.

Errors go lower:

this is apache error

[Fri Sep 26 13:57:09.339902 2014] [proxy_fcgi:error] [pid 1482:tid 140607171278592] (104)Connection reset by peer: [client 1 0.0.2.2:59655] AH01075: Error dispatching request to :3080: [Fri Sep 26 13:57:34.012455 2014] [proxy_fcgi:error] [pid 1481:tid 140607384831744] [client 10.0.2.2:59678] AH01067: Failed to read FastCGI header [Fri Sep 26 13:57:34.012455 2014] [proxy_fcgi:error] [pid 1481:tid 140607384831744] (104)Connection reset by peer: [client 1 0.0.2.2:59678] AH01075: Error dispatching request to :3080:

and this is PHP error log

[26-Sep-2014 13:43:15] NOTICE: [pool www] child 17136 started [26-Sep-2014 13:56:43] WARNING: [pool www] child 17116 exited on signal 11 (SIGSEGV - core dumped) after 2250.932709 seconds from start [26-Sep-2014 13:56:43] NOTICE: [pool www] child 17213 started [26-Sep-2014 13:57:06] WARNING: [pool www] child 17136 exited on signal 11 (SIGSEGV - core dumped) after 831.111451 seconds from start [26-Sep-2014 13:57:06] NOTICE: [pool www] child 17221 started [26-Sep-2014 13:57:09] WARNING: [pool www] child 16523 exited on signal 11 (SIGSEGV - core dumped) after 31946.504889 second s from start [26-Sep-2014 13:57:09] NOTICE: [pool www] child 17224 started [26-Sep-2014 13:57:34] WARNING: [pool www] child 17113 exited on signal 11 (SIGSEGV - core dumped) after 2574.330859 seconds from start [26-Sep-2014 13:57:34] NOTICE: [pool www] child 17233 started



98.9k

Are you using XDebug?



1.0k

Are you using XDebug?

I've installed it and run with it. I could not trace where it crashes. As soon as I try to render template with custom function, process crashes.



98.9k

A submitted a fix for this some days ago: https://github.com/xdebug/xdebug/pull/120,

You can disable xdebug to avoid this