plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

Notices and Fatal Error in Parsedown.php

Open lengthofrope opened this issue 10 years ago • 4 comments

I seem to get this error sometimes:

Notice: Array to string conversion in /vendor/yahnis-elsts/plugin-update-checker/vendor/Parsedown.php on line 1412

Notice: Undefined property: Parsedown::$Array in /vendor/yahnis-elsts/plugin-update-checker/vendor/Parsedown.php on line 1412

Fatal error: Uncaught Error: Function name must be a string in /vendor/yahnis-elsts/plugin-update-checker/vendor/Parsedown.php on line 1412

I've read here it might have something to do with PHP 7 but it happened on PHP 5.6 as well. Could you update the Parsedown script to the latest version?

lengthofrope avatar Mar 10 '16 07:03 lengthofrope

The latest version of Parsedown requires PHP 5.3, so I can't use that. I'd like to stay compatible with the minimum PHP version that's currently supported by WordPress (5.2.4). At the moment, about 9% of WordPress sites are still on PHP 5.2.

Have you found a way to reliably reproduce this error? Maybe there's a way to fix it without upgrading all the way to Parsedown 1.6.0.

YahnisElsts avatar Mar 10 '16 14:03 YahnisElsts

I'll look into it for you :)

lengthofrope avatar Mar 10 '16 18:03 lengthofrope

Hmm, the issue really is related to PHP7. For Parsedown to work, some lines need to be rewritten in Parsedown like this:

$markup .= $this->{$Element['handler']}($Element['text']);

Instead of

$markup .= $this->$Element['handler']($Element['text']);

Since that only works since PHP 5.3, would it be possible to include both the 1.5.0 version and the 1.6.0 version and load the correct one according to the installed PHP version? This way you can still support PHP 5.2, but also support newer PHP versions.

lengthofrope avatar Mar 10 '16 19:03 lengthofrope

Good to see it's merged, thnx :)

lengthofrope avatar Mar 15 '16 11:03 lengthofrope