-
Notifications
You must be signed in to change notification settings - Fork 715
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
Compiler bug in Smarty 3.1.30 #293
Comments
Hmm Note: I will be traveling for a week and it's not guaranteed that I have Internet access during that time. :( |
Good morning.
Here is my code, slightly changed to hide the vendor. abstract class ATemplateRenderer extends Smarty {
private $_pluginNamespaces = null;
public function __construct() {
parent::__construct();
/**
* We have to set this option to false to allow includes with dynamic within blocks
* This restriction should be removed in Smarty 3.2
* @see http://www.smarty.net/forums/viewtopic.php?p=86927
*/
$this->inheritance_merge_compiled_includes = false;
$this->registerDefaultPluginHandler(array($this, '__pluginHandler'));
}
public function __pluginHandler($name, $type, $template, &$callback, &$script, &$cacheable) {
if ($this->_pluginNamespaces === null) {
/**
* Load all plugin namespaces from definition files
*/
$this->loadPluginConfiguration();
}
/**
* Find plugin for namespace
* {namespace_plugin} -> namespace\PluginFunction::renderFunction()
* {namespace_plugin}{/namespace_plugin} -> namespace\PluginBlock:::renderBlock()
* {$var|namespace_plugin} -> namespace\PluginModifier::renderModifier()
*/
$parts = explode('_', $name);
if (array_key_exists($parts[0], $this->_pluginNamespaces)) {
$namespace = $parts[0];
unset($parts[0]);
$ucType = ucfirst($type);
$pluginClass = join('',array_map('ucfirst',$parts)).$ucType;
$pluginFile = $this->_pluginNamespaces[$namespace][0].$pluginClass.'.php';
if (file_exists($pluginFile)) {
$script = $pluginFile;
$callback = $this->_pluginNamespaces[$namespace][1].$pluginClass.'::render'.$ucType;
return true;
}
}
return false;
}
}
Regulary, a block named AreaBlock contains multiple ContentBlocks.
Yes
The error message:
The compiled file (I removed the vendor namespace) if (!is_callable('smarty\plugins\SeoBlock::renderBlock')) require_once 'xxx/smarty/plugins/SeoBlock.php';
if (!is_callable('smarty\plugins\StyleCollectionFunction::renderFunction')) require_once 'xxx/smarty/plugins/StyleCollectionFunction.php';
if (!is_callable('smarty\plugins\OutputBlockFunction::renderFunction')) require_once 'xxx/smarty/plugins/OutputBlockFunction.php';
--
if (!is_callable('smarty\plugins\SiterolesSubjectFunction::renderFunction')) require_once 'xxx/smarty/plugins/SiterolesSubjectFunction.php';
if (!is_callable('smarty\plugins\UriFunction::renderFunction')) require_once 'xxx/smarty/plugins/UriFunction.php';
if (!is_callable('smarty\plugins\ScriptBlock::renderBlock')) require_once 'xxx/smarty/plugins/ScriptBlock.php';
if (!is_callable('smarty\plugins\ContentBlock::renderBlock')) require_once 'xxx/smarty/plugins/ContentBlock.php';
if (!is_callable('smarty\plugins\NavigationFunction::renderFunction')) require_once 'xxx/smarty/plugins/NavigationFunction.php';
if (!is_callable('smarty\plugins\OembedBlock::renderBlock')) require_once 'xxx/smarty/plugins/OembedBlock.php';
if (!is_callable('smarty\plugins\FilesBlock::renderBlock')) require_once 'xxx/smarty/plugins/FilesBlock.php';
if (!is_callable('smarty\plugins\ImageFunction::renderFunction')) require_once 'xxx/smarty/plugins/ImageFunction.php';
if (!is_callable('smarty\plugins\AreaBlock::renderBlock')) require_once 'xxx/smarty/plugins/AreaBlock.php';
if (!is_callable('smarty\plugins\ScriptCollectionFunction::renderFunction')) require_once 'xxx/smarty/plugins/ScriptCollectionFunction.php';
$_smarty_tpl->_loadInheritance();
--
<?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_seo', array());
$_block_repeat1=true;
echo smarty\plugins\SeoBlock::renderBlock(array(), null, $_smarty_tpl, $_block_repeat1);
while ($_block_repeat1) {
ob_start();
--
<?php $_block_repeat1=false;
echo smarty\plugins\SeoBlock::renderBlock(array(), ob_get_clean(), $_smarty_tpl, $_block_repeat1);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_script', array('name'=>"xxx",'uid'=>"xxx"));
$_block_repeat1=true;
echo smarty\plugins\ScriptBlock::renderBlock(array('name'=>"xxx",'uid'=>"xxx"), null, $_smarty_tpl, $_block_repeat1);
while ($_block_repeat1) {
ob_start();
--
<?php $_block_repeat1=false;
echo smarty\plugins\ScriptBlock::renderBlock(array('name'=>"xxx",'uid'=>"xxx"), ob_get_clean(), $_smarty_tpl, $_block_repeat1);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<h2><?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_content', array('global'=>"client",'id'=>"smarty_template"));
$_block_repeat1=true;
echo smarty\plugins\ContentBlock::renderBlock(array('global'=>"client",'id'=>"smarty_template"), null, $_smarty_tpl, $_block_repeat1);
while ($_block_repeat1) {
ob_start();
?>
Client-global<?php $_block_repeat1=false;
echo smarty\plugins\ContentBlock::renderBlock(array('global'=>"client",'id'=>"smarty_template"), ob_get_clean(), $_smarty_tpl, $_block_repeat1);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<p><?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_content', array('global'=>"all",'id'=>"superglobal",'html'=>"inline",'description'=>"Superglobale Begrüßungstext"));
$_block_repeat1=true;
echo smarty\plugins\ContentBlock::renderBlock(array('global'=>"all",'id'=>"superglobal",'html'=>"inline",'description'=>"Superglobale Begrüßungstext"), null, $_smarty_tpl, $_block_repeat1);
while ($_block_repeat1) {
ob_start();
?>
Superglobal<?php $_block_repeat0=false;
echo smarty\plugins\ContentBlock::renderBlock(array('global'=>"all",'id'=>"superglobal",'html'=>"inline",'description'=>"Superglobale Begrüßungstext"), ob_get_clean(), $_smarty_tpl, $_block_repeat0);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_oembed', array('src'=>"https://youtu.be/xxx"));
$_block_repeat0=true;
echo smarty\plugins\OembedBlock::renderBlock(array('src'=>"https://youtu.be/xxx"), null, $_smarty_tpl, $_block_repeat0);
while ($_block_repeat0) {
ob_start();
--
<?php $_block_repeat0=false;
echo smarty\plugins\OembedBlock::renderBlock(array('src'=>"https://youtu.be/xxx"), ob_get_clean(), $_smarty_tpl, $_block_repeat0);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_files', array('directory_ids'=>array(320),'mimetypes'=>array('image/%')));
$_block_repeat0=true;
echo smarty\plugins\FilesBlock::renderBlock(array('directory_ids'=>array(320),'mimetypes'=>array('image/%')), null, $_smarty_tpl, $_block_repeat0);
while ($_block_repeat0) {
ob_start();
--
<?php $_block_repeat0=false;
echo smarty\plugins\FilesBlock::renderBlock(array('directory_ids'=>array(320),'mimetypes'=>array('image/%')), ob_get_clean(), $_smarty_tpl, $_block_repeat0);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<h3><?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_content', array('id'=>"headline"));
$_block_repeat2=true;
echo smarty\plugins\ContentBlock::renderBlock(array('id'=>"headline"), null, $_smarty_tpl, $_block_repeat2);
while ($_block_repeat2) {
ob_start();
?>
Überschrift<?php $_block_repeat-1=false;
echo smarty\plugins\ContentBlock::renderBlock(array('id'=>"headline"), ob_get_clean(), $_smarty_tpl, $_block_repeat-1);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
--
<?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('xxx_area', array('id'=>"test"));
$_block_repeat-1=true;
echo smarty\plugins\AreaBlock::renderBlock(array('id'=>"test"), null, $_smarty_tpl, $_block_repeat-1);
while ($_block_repeat-1) {
ob_start();
--
<?php $_block_repeat-1=false;
echo smarty\plugins\AreaBlock::renderBlock(array('id'=>"test"), ob_get_clean(), $_smarty_tpl, $_block_repeat-1);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?> |
Okay I think I'm getting closer. I see that you are using template inheritance. |
Did you receive my email? |
I had received your email. |
This compiler bug seems to be fixed in smarty/smarty:dev-master. |
I'm running in compiler bugs when I upgrade from Smarty 3.1.29 to Smarty 3.1.30. The compiled templates got syntax errors:
ContentBlock
The text was updated successfully, but these errors were encountered: