-
-
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
Volt engine template extension segfault #1031
Comments
Can you please post a test for this issue? |
make parent template like parent.volt then extend it with something like {% block footer%}abc{%endblock%} Notice that main block extension is absent. This causes segfaults 95% of time page accessed. 5% somehow works. |
Here's volt initialization call $di->set('view', function() { |
For some reason, nearly the same document structure on windows platform aborts page transfer at the end. |
Further testing shows that trouble in {% extends %} logic. If extends block removed - everything works fine |
What version of Phalcon do you use? Did you build Phalcon yourself or used fortrabit repo? I see only two memory leaks (which I am going to address) but cannot reproduce the crash. |
|
Here is my code: test.php: <?php
$di = new \Phalcon\DI\FactoryDefault();
$di->set('view', function() {
$view = new \Phalcon\Mvc\View();
$view->setViewsDir(__DIR__ . '/');
$view->registerEngines(array(
".volt" => function($view, $di) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions(array(
"compiledPath" => __DIR__ . '/',
"compiledExtension" => ".compiled",
"compileAlways" => true
));
$volt->tag->setDoctype(\Phalcon\Tag::HTML5);
return $volt;
}
));
$view->title = "Sky";
return $view;
});
$view = $di->getShared('view');
$view->start();
$view->render('', 'child');
$view->finish();
echo $view->getContent(); parent.volt:
child.volt:
Could you please verify whether this code crashes? |
Thank you for fast response. We will retest bug with various environment to localize it more precisely within 2 days. |
I really don't understand this bug logic, but it works only on this environment: Project structure (important):
app/view/index.volt code {% extends "index/parent.volt" %}
{# % block head %}{% endblock % #}
{% block title %}Error 404{% endblock %}
{% block content %}
<h1>Error 404</h1>
<p>Page you're looking not found</p>
{% endblock %} app/view/parent.volt code {{get_doctype()}}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
{{ stylesheet_link("css/global.css") }}
{% block head %}{% endblock %}
<title>{% block title %}Main{% endblock %}</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html> public/test.php code: $di = new \Phalcon\DI\FactoryDefault();
$di->set('view', function() {
$view = new \Phalcon\Mvc\View();
$view->setViewsDir(__DIR__ . '/../app/views/');
$view->registerEngines(array(
".volt" => function($view, $di) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions(array(
"compiledPath" => __DIR__ . '/../app/compiled-templates/',
"compiledExtension" => ".compiled",
"compileAlways" => true
));
$volt->tag->setDoctype(\Phalcon\Tag::HTML5);
return $volt;
}
));
$view->title = "Sky";
return $view;
});
$view = $di->getShared('view');
$view->start();
$view->render('', 'index/index');
$view->finish();
echo $view->getContent(); First I noticed this bug when added index.volt head block comments Changing something like removing css link from index.volt, changing template position in filesystem, changing volt options like compileSeparator or compileAlways - everything removes this bug. Only this environment gives it. I cloned project from github like it described in documentation and executed build/install script My system is Debian 7 x64 |
Could you please build phalcon in debug mode: cd ext
phpize && ./configure CFLAGS="-g3 -O0" && make -j4
sudo make install and try to run it under valgrind: valgrind --read-var-info=yes --fullpath-after= --track-origins=yes /usr/bin/php /path/to/index.php and paste the output somewhere here. |
Command: valgrind --read-var-info=yes --fullpath-after= --track-origins=yes /usr/bin/php test.php
|
Please, let me know if there any steps forward for this issue, as it very important for our current project. |
I've recompiled recent phalcon 1.2.3 version for recent php 5.5.1 version. Bug is present. |
Now I have debug information for php binary: ==16016== Memcheck, a memory error detector
|
Can you try compiling again from master? |
Excellent! Test code now works. I very appreciate your work guys. Thanks. |
When extending parent template, if you do not override one of the parent blocks - you get segmentation fault.
Debian 7 x64
The text was updated successfully, but these errors were encountered: