我在WAMP下与Phalcon和Volt合作。最近我们搬到了另一个开发环境(CentOS),在那里我有PHP 5.5.17和最新的Phalcon构建(我编译并测试了两个版本也低了)。
现在,当Volt尝试使用自定义函数编译模板时,它会崩溃(PHP进程)。同样如此 关于自定义过滤器。
Apache的错误日志
[Tue Sep 30 06:06:24.809476 2014] [proxy_fcgi:error] [pid 31199:tid 140596014397184] (104)Connection reset by peer: [client 10.0.2.2:53931] AH01075: Error dispatching request to :3080:
[Tue Sep 30 06:06:27.216226 2014] [proxy_fcgi:error] [pid 31200:tid 140596161255168] [client 10.0.2.2:53941] AH01067: Failed to read FastCGI header
[Tue Sep 30 06:06:27.216249 2014] [proxy_fcgi:error] [pid 31200:tid 140596161255168] (104)Connection reset by peer: [client 10.0.2.2:53941] AH01075: Error dispatching request to :3080:
PHP错误日志
[30-Sep-2014 06:06:27] WARNING: [pool www] child 32519 exited on signal 11 (SIGSEGV - core dumped) after 204.725812 seconds from start
[30-Sep-2014 06:06:27] NOTICE: [pool www] child 32529 started
PHP代码看起来像
$di->set('view', function () use ($config) {
$view = new View();
$view->setViewsDir($config->application->viewsDir);
$view->registerEngines(array(
'.volt' => function ($view, $di) use ($config) {
$volt = new VoltEngine($view, $di);
$volt->setOptions(array(
'compiledPath' => $config->application->cacheDir,
'compiledSeparator' => '_',
'compileAlways' => $config->application->debug
));
$compiler = $volt->getCompiler();
$compiler->addFunction(
'last',
function ($resolvedArgs) use ($compiler) {
return 'array_pop('. $resolvedArgs .')';
}
);
return $volt;
}
));
return $view;
}, true);
以Volt为例
{{ last(['1', '2', '3']) }}
我真的坚持这个问题,因为我有很多自定义功能,我确实需要它们。试图调试它,但是,只要伏特尝试用自定义函数解析行,就会死掉。
提交了Phalcon bug。解决方案:完全禁用xdebug以进行当前构建。更多信息:https://github.com/xdebug/xdebug/pull/120