-
Notifications
You must be signed in to change notification settings - Fork 1
Fatal error when saving as draft #6
Copy link
Copy link
Open
Description
Hello everyone,
A fatal error occurs if the entry is saved as a draft with at least one tag.
Setup:
PHP8.1, Apache/2.4.56 (Debian), FlatPress 1.3 commit 1005, FlatPress commit 1131
Possible source of the error:
flatpress_tag_plugin/tag/inc/entry.php
Line 203 in 7a665cf
| $count = count($entries); |
Steps for reproducibility:
- create a new entry (do not save as draft yet)
- assign at least 1 tag
- save the entry as a draft
Output:
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /var/www/html/flatpress-master-1131/fp-plugins/tag/inc/entry.php:203 Stack trace: #0 /var/www/html/flatpress-master-1131/fp-plugins/tag/inc/entry.php(235): plugin_tag_entry->smarty_modifier() #1 /var/www/html/flatpress-master-1131/fp-includes/core/core.wp-plugin-interface.php(54): plugin_tag_entry->tag_bottomlist() #2 /var/www/html/flatpress-master-1131/fp-includes/core/core.theme.php(282): apply_filters() #3 /var/www/html/flatpress-master-1131/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^03f9ca9b2f4f93f28119f02005895bbb122563ba_0.file.preview.tpl.php(38): theme_apply_filters_wrapper() #4 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_resource_base.php(123): content_65a2ac069c19c4_82947477() #5 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() #6 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render() #7 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render() #8 /var/www/html/flatpress-master-1131/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^1f7adbccfb8e329335e1539d0ce4e63da2e8be81_0.admin.entrywrite.php(49): Smarty_Internal_Template->_subTemplateRender() #9 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_resource_base.php(123): content_65a2abb224d621_03767663() #10 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() #11 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render() #12 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render() #13 /var/www/html/flatpress-master-1131/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^ce076dca0534e021a3d1962070b7d04ed33c3ead_0.file.main.tpl.php(89): Smarty_Internal_Template->_subTemplateRender() #14 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_resource_base.php(123): content_659fe0ee417170_52864076() #15 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() #16 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render() #17 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render() #18 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute() #19 /var/www/html/flatpress-master-1131/admin/main.php(151): Smarty_Internal_TemplateBase->display() #20 /var/www/html/flatpress-master-1131/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^176eb26d3edd0d7d9a12d5300598090f26510b74_0.file.admin.tpl.php(54): showcontrolpanel() #21 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_resource_base.php(123): content_659fe0ee372a96_67383435() #22 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() #23 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render() #24 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render() #25 /var/www/html/flatpress-master-1131/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute() #26 /var/www/html/flatpress-master-1131/admin/main.php(191): Smarty_Internal_TemplateBase->display() #27 /var/www/html/flatpress-master-1131/admin.php(6): require('...') #28 {main} thrown in /var/www/html/flatpress-master-1131/fp-plugins/tag/inc/entry.php on line 203
Cached file:
<?php
/* Smarty version 4.3.1, created on 2024-01-13 15:28:06
from '/var/www/html/flatpress-master-1131/fp-interface/themes/leggero/preview.tpl' */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '4.3.1',
'unifunc' => 'content_65a2ac069c19c4_82947477',
'has_nocache_code' => false,
'file_dependency' =>
array (
'03f9ca9b2f4f93f28119f02005895bbb122563ba' =>
array (
0 => '/var/www/html/flatpress-master-1131/fp-interface/themes/leggero/preview.tpl',
1 => 1704564988,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_65a2ac069c19c4_82947477 (Smarty_Internal_Template $_smarty_tpl) {
?> <?php $_block_plugin1 = isset($_smarty_tpl->smarty->registered_plugins['block']['entry'][0]) ? $_smarty_tpl->smarty->registered_plugins['block']['entry'][0] : null;
if (!is_callable($_block_plugin1)) {
throw new SmartyException('block tag \'entry\' not callable or registered');
}
$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('entry', array('content'=>$_smarty_tpl->tpl_vars['entry']->value));
$_block_repeat=true;
echo $_block_plugin1(array('content'=>$_smarty_tpl->tpl_vars['entry']->value), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
<div class="entry">
<?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'date_format_daily' ][ 0 ], array( $_smarty_tpl->tpl_vars['date']->value,"<h6 class=\"date\">".((string)$_smarty_tpl->tpl_vars['fp_config']->value['locale']['dateformat'])."</h6>" ));?>
<h2 class="entry-title"><?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'tag' ][ 0 ], array( $_smarty_tpl->tpl_vars['subject']->value,'the_title' ));?>
</h2>
<?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'tag' ][ 0 ], array( $_smarty_tpl->tpl_vars['content']->value,'the_content' ));?>
<ul class="entry-footer">
<li class="entry-info">
<p class="date"><?php echo $_smarty_tpl->tpl_vars['lang']->value['entryauthor']['posted_by'];?>
<?php echo $_smarty_tpl->tpl_vars['author']->value;?>
<?php echo $_smarty_tpl->tpl_vars['lang']->value['entryauthor']['at'];?>
<?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'date_format' ][ 0 ], array( $_smarty_tpl->tpl_vars['date']->value ));?>
</p>
</li>
</ul>
</div>
<?php $_block_repeat=false;
echo $_block_plugin1(array('content'=>$_smarty_tpl->tpl_vars['entry']->value), ob_get_clean(), $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);
}
}
<?php
/* Smarty version 4.3.1, created on 2024-01-13 15:26:42
from 'admin:entrywrite' */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '4.3.1',
'unifunc' => 'content_65a2abb224d621_03767663',
'has_nocache_code' => false,
'file_dependency' =>
array (
'1f7adbccfb8e329335e1539d0ce4e63da2e8be81' =>
array (
0 => 'admin:entrywrite',
1 => 1704661607,
2 => 'admin',
),
),
'includes' =>
array (
'shared:errorlist.tpl' => 1,
'file:preview.tpl' => 1,
'plugin:bbcode/toolbar' => 1,
),
),false)) {
function content_65a2abb224d621_03767663 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/var/www/html/flatpress-master-1131/fp-includes/fp-smartyplugins/block.html_form.php','function'=>'smarty_block_html_form',),1=>array('file'=>'/var/www/html/flatpress-master-1131/fp-includes/fp-smartyplugins/function.list_categories.php','function'=>'smarty_function_list_categories',),2=>array('file'=>'/var/www/html/flatpress-master-1131/fp-includes/fp-smartyplugins/function.html_submit.php','function'=>'smarty_function_html_submit',),));
?>
<h2><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['head'];?>
</h2>
<?php $_smarty_tpl->_subTemplateRender("shared:errorlist.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>
<?php $_block_plugin1 = isset($_smarty_tpl->smarty->registered_plugins['block']['entry_block'][0]) ? $_smarty_tpl->smarty->registered_plugins['block']['entry_block'][0] : null;
if (!is_callable($_block_plugin1)) {
throw new SmartyException('block tag \'entry_block\' not callable or registered');
}
$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('entry_block', array());
$_block_repeat=true;
echo $_block_plugin1(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
<div id="admin-post-preview">
<?php if ((isset($_smarty_tpl->tpl_vars['preview']->value))) {?>
<fieldset id="post-preview"><legend><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['preview'];?>
</legend>
<?php $_smarty_tpl->_subTemplateRender("file:preview.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>
</fieldset>
<?php }?>
</div>
<?php $_smarty_tpl->smarty->_cache['_tag_stack'][] = array('html_form', array());
$_block_repeat=true;
echo smarty_block_html_form(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
<?php if (!(isset($_smarty_tpl->tpl_vars['post']->value))) {?>
<?php $_smarty_tpl->_assignInScope('post', '');?>
<?php }?>
<?php $_block_plugin2 = isset($_smarty_tpl->smarty->registered_plugins['block']['entry'][0]) ? $_smarty_tpl->smarty->registered_plugins['block']['entry'][0] : null;
if (!is_callable($_block_plugin2)) {
throw new SmartyException('block tag \'entry\' not callable or registered');
}
$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('entry', array('content'=>$_smarty_tpl->tpl_vars['post']->value,'alwaysshow'=>true));
$_block_repeat=true;
echo $_block_plugin2(array('content'=>$_smarty_tpl->tpl_vars['post']->value,'alwaysshow'=>true), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
<!-- BOF Datechanger- Plugin --><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['action'][0], array( array('hook'=>'simple_datechanger_form'),$_smarty_tpl ) );?>
<!-- EOF Datechanger- Plugin -->
<div id="admin-editor">
<p><label for="subject"><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['subject'];?>
</label><br>
<?php if ((isset($_smarty_tpl->tpl_vars['error']->value)) && (isset($_smarty_tpl->tpl_vars['error']->value['subject'])) && !empty($_smarty_tpl->tpl_vars['error']->value['subject'])) {?>
<?php $_smarty_tpl->_assignInScope('class', "field-error");?>
<?php } else { ?>
<?php $_smarty_tpl->_assignInScope('class', '');?>
<?php }?>
<input type="text" name="subject" id="subject" class="<?php echo $_smarty_tpl->tpl_vars['class']->value;?>
"
value="<?php ob_start();
echo (($tmp = $_REQUEST['subject'] ?? null)===null||$tmp==='' ? '' ?? null : $tmp);
$_prefixVariable1 = ob_get_clean();
echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'wp_specialchars' ][ 0 ], array( (($tmp = $_smarty_tpl->tpl_vars['subject']->value ?? null)===null||$tmp==='' ? $_prefixVariable1 ?? null : $tmp),1 ));?>
"><br>
<input type="hidden" name="timestamp" value="<?php echo $_smarty_tpl->tpl_vars['date']->value;?>
">
<input type="hidden" name="entry" value="<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
">
</p>
<p>
<label for="content"><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['content'];?>
</label>
</p>
<?php if (function_exists('plugin_bbcode_init')) {?>
<?php $_smarty_tpl->_subTemplateRender("plugin:bbcode/toolbar", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>
<?php }?>
<p>
<?php if ((isset($_smarty_tpl->tpl_vars['error']->value)) && (isset($_smarty_tpl->tpl_vars['error']->value['content'])) && !empty($_smarty_tpl->tpl_vars['error']->value['content'])) {?>
<?php $_smarty_tpl->_assignInScope('class', "field-error");?>
<?php } else { ?>
<?php $_smarty_tpl->_assignInScope('class', '');?>
<?php }?>
<textarea name="content" id="content" class="<?php echo $_smarty_tpl->tpl_vars['class']->value;?>
"
rows="20" cols="74"><?php ob_start();
echo (($tmp = $_REQUEST['content'] ?? null)===null||$tmp==='' ? '' ?? null : $tmp);
$_prefixVariable2 = ob_get_clean();
echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'htmlspecialchars' ][ 0 ], array( (($tmp = $_smarty_tpl->tpl_vars['content']->value ?? null)===null||$tmp==='' ? $_prefixVariable2 ?? null : $tmp) ));?>
</textarea><br>
</p>
</div>
<!-- BOF SEO-Metataginfo- Plugin --><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['action'][0], array( array('hook'=>'simple_metatag_info'),$_smarty_tpl ) );?>
<!-- EOF SEO-Metataginfo- Plugin -->
<!-- BOF Tag- Plugin --><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['action'][0], array( array('hook'=>'simple_tag_form'),$_smarty_tpl ) );?>
<!-- EOF Tag- Plugin -->
<!-- BOF CommentCenter- Plugin --><?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['action'][0], array( array('hook'=>'simple_edit_form'),$_smarty_tpl ) );?>
<!-- EOF CommentCenter- Plugin -->
<div id="admin-options">
<fieldset id="admin-entry-categories"><legend><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['categories'];?>
</legend>
<?php echo smarty_function_list_categories(array('type'=>'form','selected'=>$_smarty_tpl->tpl_vars['categories']->value),$_smarty_tpl);?>
</fieldset>
<fieldset id="admin-entry-saveopts"><legend><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['saveopts'];?>
</legend>
<p>
<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['saved_flags']->value, 'flag');
$_smarty_tpl->tpl_vars['flag']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['flag']->value) {
$_smarty_tpl->tpl_vars['flag']->do_else = false;
?>
<label><input name="flags[<?php echo $_smarty_tpl->tpl_vars['flag']->value;?>
]"<?php if ($_smarty_tpl->tpl_vars['categories']->value && (bool)array_intersect(array($_smarty_tpl->tpl_vars['flag']->value),$_smarty_tpl->tpl_vars['categories']->value)) {?>checked="checked"<?php }?> type="checkbox"><?php echo $_smarty_tpl->tpl_vars['lang']->value['entry']['flags']['long'][$_smarty_tpl->tpl_vars['flag']->value];?>
</label><br>
<?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
</p>
</fieldset>
</div>
<div class="buttonbar">
<?php echo smarty_function_html_submit(array('name'=>"save",'id'=>"save",'value'=>$_smarty_tpl->tpl_vars['panelstrings']->value['submit'],'accesskey'=>'s'),$_smarty_tpl);?>
<?php echo smarty_function_html_submit(array('name'=>"savecontinue",'id'=>"savecontinue",'value'=>$_smarty_tpl->tpl_vars['panelstrings']->value['savecontinue'],'accesskey'=>'c'),$_smarty_tpl);?>
<?php echo smarty_function_html_submit(array('name'=>"preview",'id'=>"preview",'value'=>$_smarty_tpl->tpl_vars['panelstrings']->value['preview'],'accesskey'=>'p'),$_smarty_tpl);?>
</div>
<?php $_block_repeat=false;
echo $_block_plugin2(array('content'=>$_smarty_tpl->tpl_vars['post']->value,'alwaysshow'=>true), ob_get_clean(), $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);
$_block_repeat=false;
echo smarty_block_html_form(array(), ob_get_clean(), $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
<?php $_block_repeat=false;
echo $_block_plugin1(array(), ob_get_clean(), $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
<?php if ((isset($_GET['entry']))) {?>
<div id="admin-otheroptions">
<h2><?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['otheropts'];?>
</h2>
<ul>
<?php if (!(isset($_smarty_tpl->tpl_vars['draft']->value))) {?>
<li><a href="admin.php?p=entry&entry=<?php echo $_GET['entry'];?>
&action=commentlist">
<?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['commmsg'];?>
</a></li>
<?php }?>
<li><a href="admin.php?p=entry&entry=<?php echo $_GET['entry'];?>
&action=delete">
<?php echo $_smarty_tpl->tpl_vars['panelstrings']->value['delmsg'];?>
</a></li>
</ul>
</div>
<?php }
}
}
With best regards
Frank
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels