Tag-Plugin - Error 500 - Smarty 4

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
User avatar
fraenkiman
Posts: 307
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Tag-Plugin - Error 500 - Smarty 4

Post by fraenkiman » Sun Oct 30, 2022 8:07 pm

Hello, everyone,

when trying to activate the plugin tag under FlatPress 1.3dev [master], I get the following error message:
This page does not work frank-web.dedyn.io is currently unable to process this request.
HTTP ERROR 500


Strangely, there is no error found in the log files (syslog and apache error.log).

Apache/2.4.54
PHP 7.4.30 FPM/FastCGI

Maybe someone would like to take a look and confirm that the error exists. Maybe also with abnormalities in the log files.

Under Smarty 2.6 the plugin works perfectly.
It would be a shame if this plugin didn't work with Smarty 4.

Best Regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
Arvid
FlatPress Coder
Posts: 609
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Tag-Plugin - Error 500 - Smarty 4

Post by Arvid » Tue Nov 01, 2022 12:26 pm

Hi,

thanks for reporting. This will happen with a few more plugins, I'm afraid: With the update to Smarty 4, the name conventions of Smarty functions have changed (assignByRef() instead of assign_by_ref(), for example), and the register_...() functions have been combined to registerPlugin($type, ...).

It's actually not too hard to fix: Just check for Smarty function calls within the plugin code (search for

Code: Select all

$smarty->
), and change them. (Still waiting for the official Smarty 3 to 4 upgrade guide, though...)

I did the fix for the Tag plugin, see my fork here: https://github.com/azett/flatpress_tag_plugin
And I sent Evaggelos a pull request to merge my changes back into his repo: https://github.com/ebal/flatpress_tag_plugin/pull/3

All the best,
Arvid

User avatar
fraenkiman
Posts: 307
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Tag-Plugin - Error 500 - Smarty 4

Post by fraenkiman » Tue Nov 01, 2022 9:51 pm

Hello Arvid,

Thank you for creating the fork with the fixes. Tested with fp-1.3dev [master] (smarty 4) without any abnormalities. Works as expected :) .

Best Regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io


User avatar
fraenkiman
Posts: 307
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Tag-Plugin v2.6.3 for FlatPress 1.3 "Andante" Beta1

Post by fraenkiman » Sun Jan 21, 2024 6:58 pm

Hello everyone,

I have fixed a fatal error in the tag plugin, which occurred when you wanted to save an entry as a draft with a set tag.
The plugin is available for download from the wiki, among other places.

Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

lantaca
Posts: 10
Joined: Thu May 23, 2024 9:02 pm

Re: Tag-Plugin - Error 500 - Smarty 4

Post by lantaca » Tue May 28, 2024 9:21 am

hi
i have just download from wiki the plug in version 2.6.3 but...

Code: Select all

Fatal error: Uncaught Error: Call to undefined function load_lang() in /membri/lantaca/fp-plugins/tag/inc/entry.php:246 Stack trace: #0 /membri/lantaca/fp-includes/core/core.wp-plugin-interface.php(54): plugin_tag_entry->tag_bottomlist('<div class="psw...') #1 /membri/lantaca/fp-includes/core/core.theme.php(282): apply_filters('the_content', '<div class="psw...') #2 /membri/lantaca/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^c92b91e994c4c4361a14578cf44e651a76692c1d_0.file.entry-default.tpl.php(45): theme_apply_filters_wrapper('[img=images/Sta...', 'the_content') #3 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_resource_base.php(123): content_664fb50f1f6396_22237894(Object(Smarty_Internal_Template)) #4 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template)) #5 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template)) #6 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render() #7 /membri/lantaca/fp-content/cache/e93fccb09cf8b04111b9595da102f3f4^334da54e1616283229e0048bd6b9083f21bc13d9_0.file.index.tpl.php(53): Smarty_Internal_Template->_subTemplateRender('file:entry-defa...', NULL, 'e93fccb09cf8b04...', 0, 3600, Array, 0, false) #8 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_resource_base.php(123): content_664fb50f1b1c14_91728885(Object(Smarty_Internal_Template)) #9 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template)) #10 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template)) #11 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render(false, 1) #12 /membri/lantaca/fp-includes/smarty-4.3.1/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, NULL, NULL, 1) #13 /membri/lantaca/index.php(186): Smarty_Internal_TemplateBase->display('index.tpl') #14 /membri/lantaca/index.php(194): index_display() #15 {main} thrown in /membri/lantaca/fp-plugins/tag/inc/entry.php on line 246
i use [tag] [/tag]

User avatar
Arvid
FlatPress Coder
Posts: 609
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Tag-Plugin - Error 500 - Smarty 4

Post by Arvid » Mon Jul 01, 2024 5:52 pm

I checked, but I can't reproduce Luca's error message "Call to undefined function load_lang()". But I can't find the definition of load_lang() itself, either :shock:

What I discovered instead is a rather ugly dynamic property error:

Code: Select all

Deprecated: Creation of dynamic property plugin_tag::$widget_class is deprecated in /[...]/fp-plugins/tag/plugin.tag.php on line 163
All the best,
Arvid

User avatar
fraenkiman
Posts: 307
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Tag-Plugin - Error 500 - Smarty 4

Post by fraenkiman » Wed Jul 03, 2024 9:13 pm

Hello you two,

I also have something to add:
After emptying the template cache and writing a new entry, I get these two messages:

Code: Select all

PHP Deprecated:  Using unregistered function "addslashes" in a template is deprecated and will be removed in a future release. Use Smarty::registerPlugin to [...], referer: https://localhost/flatpress-master-1416/admin.php?p=entry
PHP Deprecated:  Using unregistered function "plugin_geturl" in a template is deprecated and will be removed in a future release. Use Smarty::registerPlugin to  [...], referer: C:/Public/_Programme/xampp/php/php-cgi.exe, referer: https://localhost/flatpress-master-1416/admin.php?p=entry
Fixed with 902ec47

Then I get a lot:

Code: Select all

PHP Deprecated:  Creation of dynamic property plugin_tag::$admin_class is deprecated in C:\\Public\\_Programme\\xampp\\htdocs\\flatpress-master-1416\\fp-plugins\\tag\\plugin.tag.php on line 88: [...] , referer: https://localhost/flatpress-master-1416/admin.php?p=entry
That's where I find this function:

Code: Select all

		// Update tags when you post an entry
		if (defined('MOD_ADMIN_PANEL')) {
			include_once $tag_inc . 'admin.php';
			$this->admin_class = new plugin_tag_admin($this->tagdb_class, $this->entry_class);
			$this->admin_class->use_rewrite = $this->rewrite_link;
		}
The warning that Arvid found applies to this function:

Code: Select all

	/**
	 * The tag cloud.
	 *
	 * This function is here because it includes another file
	 * that makes all we want, so we don't have too much
	 * functions...
	 */
	function tag_cloud() {
		if (!isset($this->widget_class)) {
			$tag_inc = dirname(__FILE__) . '/inc/';
			include_once $tag_inc . 'widget.php';
			$this->widget_class = new plugin_tag_widget($this->tagdb_class, $this->entry_class);
		}

		return $this->widget_class->tagCloud();
	}
PHP Version 8.2.12
Smarty Version 4.5.2 / current developer version

I can't fix these dynamic property errors on my own. I need support from the Ruhr area :D .

The tag plugin is in the Ertra repo

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
fraenkiman
Posts: 307
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Tag-Plugin - Error 500 - Smarty 4

Post by fraenkiman » Sat Jul 13, 2024 1:33 pm

Hello everyone,

it may be sufficient to set the parameters between

Code: Select all

class plugin_tag {
and

Code: Select all

function __construct() {
to define.
Source: https://stackoverflow.com/a/77725956

In my case, it looks like this from line 34 onwards:

Code: Select all

class plugin_tag {

	// Is PrettyURLs or RewriteURLs enabled?
	var $rewrite_link = false;

	// Tagdb, null for now
	var $tagdb_class = null;

	// Entry_tag, null for now
	var $entry_class = null;

	// more params is declared here
	var $admin_class = null;
	var $widget_class = null;
	var $init_class = null;

	/**
	 * plugin_tag
	 *
	 * The constructor.
	 * It makes the basic set up of the plugin.
	 */
	function __construct() {
At least I no longer receive any warnings.
@Arvid, what do you think?

Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
fraenkiman
Posts: 307
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Tag-Plugin - Error 500 - Smarty 4

Post by fraenkiman » Sat Jul 27, 2024 7:06 pm

The ugly errors with dynamic properties have been fixed. Download as usual via the Wiki or FlatPress-extras-Repo.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest