flatpress icon indicating copy to clipboard operation
flatpress copied to clipboard

PHP warning: when calling the Atom / RSS feed

Open Fraenkiman opened this issue 1 year ago • 3 comments

Hello everyone,

Calling an Atom feed (https://domain.ltd/?x=feed:atom or https://domain.ltd/?x=feed:rss2) generates the following warning in the server log:

PHP message: PHP Warning:  Undefined array key "www" in /var/www/html/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^0536a2801ade15c71578e1157b5c1f8740e32d11_0.file.comment-atom.tpl.php on line 101
PHP message: PHP Warning:  Attempt to read property "value" on null in /var/www/html/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^0536a2801ade15c71578e1157b5c1f8740e32d11_0.file.comment-atom.tpl.php on line 101'
PHP message: PHP Deprecated:  Using php-function "theme_comments_feed_link" as a modifier is deprecated and will be removed in a future release. Use Smarty::registerPlugin to explicitly register a custom modifier. 

It may be necessary to add a few comments to an entry in advance. The commentator does not enter their own "www"website.

Precondition: PHP8.1

Cached file:

<?php
/* Smarty version 4.3.4, created on 2024-01-31 18:07:23
  from '/var/www/html/fp-interface/sharedtpls/comment-atom.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.3.4',
  'unifunc' => 'content_65ba8c5b9fe9c1_00023409',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '0536a2801ade15c71578e1157b5c1f8740e32d11' => 
    array (
      0 => '/var/www/html/fp-interface/sharedtpls/comment-atom.tpl',
      1 => 1667502426,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_65ba8c5b9fe9c1_00023409 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/var/www/html/fp-includes/smarty-4.3.4/libs/plugins/modifier.date_format.php','function'=>'smarty_modifier_date_format',),));
echo '<?'; ?>
xml version="1.0" encoding="<?php echo $_smarty_tpl->tpl_vars['flatpress']->value['charset'];?>
"<?php echo '?>'; ?>

<feed xmlns="http://www.w3.org/2005/Atom">

	<title><?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'tag' ][ 0 ], array( $_smarty_tpl->tpl_vars['flatpress']->value['title'],'wp_title',':' ));?>
</title>
	<subtitle><?php echo $_smarty_tpl->tpl_vars['flatpress']->value['subtitle'];?>
</subtitle>
	<link href="<?php echo (defined('BLOG_BASEURL') ? constant('BLOG_BASEURL') : null);?>
">
	<link rel="self" href="<?php echo htmlspecialchars((string)$_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8', true);?>
">
	<generator uri="http://www.flatpress.org/" version="<?php echo (defined('SYSTEM_VER') ? constant('SYSTEM_VER') : null);?>
">
  		FlatPress
	</generator>
	<rights> <?php echo $_smarty_tpl->tpl_vars['flatpress']->value['author'];?>
 <?php echo smarty_modifier_date_format(time(),'%Y');?>
 </rights>
	
	<?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();?>
	<?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());
$_block_repeat=true;
echo $_block_plugin2(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
	
	<updated><?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'date_rfc3339' ][ 0 ], array( $_smarty_tpl->tpl_vars['date']->value ));?>
</updated>
	<author>
		<name><?php echo $_smarty_tpl->tpl_vars['author']->value;?>
</name>
	</author>
	<id><?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'link' ][ 0 ], array( $_smarty_tpl->tpl_vars['id']->value,'post_link' ));?>
</id>
	
	<?php $_smarty_tpl->_assignInScope('the_comment_link', call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'link' ][ 0 ], array( $_smarty_tpl->tpl_vars['id']->value,'comments_link' )));?>

	<?php $_block_plugin3 = isset($_smarty_tpl->smarty->registered_plugins['block']['comment_block'][0]) ? $_smarty_tpl->smarty->registered_plugins['block']['comment_block'][0] : null;
if (!is_callable($_block_plugin3)) {
throw new SmartyException('block tag \'comment_block\' not callable or registered');
}
$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('comment_block', array());
$_block_repeat=true;
echo $_block_plugin3(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
	<?php $_block_plugin4 = isset($_smarty_tpl->smarty->registered_plugins['block']['comment'][0]) ? $_smarty_tpl->smarty->registered_plugins['block']['comment'][0] : null;
if (!is_callable($_block_plugin4)) {
throw new SmartyException('block tag \'comment\' not callable or registered');
}
$_smarty_tpl->smarty->_cache['_tag_stack'][] = array('comment', array());
$_block_repeat=true;
echo $_block_plugin4(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();?>
	<entry>
		<title><?php echo $_smarty_tpl->tpl_vars['name']->value;?>
</title>
		<author>
			<name><?php echo $_smarty_tpl->tpl_vars['name']->value;?>
</name>
			<?php if ($_smarty_tpl->tpl_vars['www']->value) {?><uri><?php echo $_smarty_tpl->tpl_vars['www']->value;?>
</uri><?php }?>
		</author>
		<link href="<?php echo $_smarty_tpl->tpl_vars['the_comment_link']->value;?>
#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
">
		<id><?php echo $_smarty_tpl->tpl_vars['the_comment_link']->value;?>
#<?php echo $_smarty_tpl->tpl_vars['id']->value;?>
</id>
		<?php $_smarty_tpl->_assignInScope('the_date', call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'date_rfc3339' ][ 0 ], array( $_smarty_tpl->tpl_vars['date']->value )));?>
		<published><?php echo $_smarty_tpl->tpl_vars['the_date']->value;?>
</published>
		<updated><?php echo $_smarty_tpl->tpl_vars['the_date']->value;?>
</updated>
		<content type="xhtml">
			<div xmlns="http://www.w3.org/1999/xhtml"> 
				 <?php echo call_user_func_array($_smarty_tpl->registered_plugins[ 'modifier' ][ 'tag' ][ 0 ], array( $_smarty_tpl->tpl_vars['content']->value,'the_content' ));?>
 
			</div>
		</content>
	</entry>
	<?php $_block_repeat=false;
echo $_block_plugin4(array(), ob_get_clean(), $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
	<?php $_block_repeat=false;
echo $_block_plugin3(array(), ob_get_clean(), $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_cache['_tag_stack']);?>
	
	<?php $_block_repeat=false;
echo $_block_plugin2(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']);?>
	
</feed>
<?php }
}

Associated files: atom.tpl Line 7 and Line 25, rss.tpl Line 5, comment-rss.tpl Line 14, comments.php Line 52, Line 95 and 129 Possibly also: stringparser.class.php and stringparser_bbcode.class.php

With best regards Frank

Fraenkiman avatar Jan 31 '24 20:01 Fraenkiman

Can't seem to reproduce this one...tried it here, no entries in the error log... Current master, PHP 8.3, fresh installation.

azett avatar Feb 03 '24 14:02 azett

@Fraenkiman Are you able to reproduce this one?

azett avatar Mar 03 '24 13:03 azett

Hi @azett, I can't find the trigger at the moment. Therefore I leave the issue open, but remove it from the milestone

Fraenkiman avatar Mar 03 '24 17:03 Fraenkiman