Skip to content
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

Volt compiler fails on custom functions #2863

Closed
iamolegko opened this issue Sep 30, 2014 · 4 comments
Closed

Volt compiler fails on custom functions #2863

iamolegko opened this issue Sep 30, 2014 · 4 comments

Comments

@iamolegko
Copy link

When Volt compiler tries to parse custom function in template, php process die

WARNING: [pool www] child 32519 exited on signal 11 (SIGSEGV - core dumped) after 204.725812 seconds from start

Same is for custom filters.


Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.

@dreamsxin
Copy link
Contributor

Can't give example code?

@iamolegko
Copy link
Author

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) {
                                       return 'array_pop('. $resolvedArgs .')';
                                    }
                );

                return $volt;
            }
    ));

return $view;
}, true);

AND Volt example

{{ last(['1', '2', '3']) }}

@phalcon
Copy link
Collaborator

phalcon commented Sep 30, 2014

Probably related xdebug/xdebug#120

@iamolegko
Copy link
Author

Disabled xdebug and started to work. Thanks

@phalcon phalcon closed this as completed Nov 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants