shazahm1 / WP-Syntax

WP-Syntax WordPress Plugin
connections-pro.com
GNU General Public License v2.0
13 stars 11 forks source link

Please upgrade the plugin version available on https://wordpress.org/plugins/wp-syntax/ to fix it for PHP 8 (that removed create_function) #32

Closed michaliskambi closed 10 months ago

michaliskambi commented 10 months ago

The version of this plugin currently released on https://wordpress.org/plugins/wp-syntax/ has the geshi.php version that uses create_function, which unfortunately fails with PHP 8 (that removed create_function, https://www.php.net/manual/en/function.create-function.php ).

I found that latest version of geshi.php, 1.0.9.1, from https://github.com/GeSHi/geshi-1.0/blob/master/src/geshi.php , has this issue fixed.

Then I found that actually this repository also already has a fix, https://github.com/shazahm1/WP-Syntax/commit/4fe9a200b14b369a6b43b36f18ca2cb1f1afeb2c :) So, while I would advise to upgrade to GeSHi 1.0.9.1 (to rely on GeSHi code used also by other frameworks, like Drupal), the practical problem is also already fixed here.

But the https://wordpress.org/plugins/wp-syntax/ doesn't contain this fix. Although it says "Last updated:8 months ago" (so after the commit https://github.com/shazahm1/WP-Syntax/commit/4fe9a200b14b369a6b43b36f18ca2cb1f1afeb2c ), but the contents downloaded from https://downloads.wordpress.org/plugin/wp-syntax.1.1.zip contain geshi.php with create_function used. And it indeed fails with PHP 8, e.g. when trying to use this code in Wordpress post:

<pre lang="cpp" line="1">__fastcall void TViewMain::ClickMove(TObject* Sender)
{
    Scene1->Translation = Scene1->Translation + Vector3(0, 1, 0);
}

__fastcall void TViewMain::ClickBunny(TObject* Sender)
{
    Scene1->Url = "castle-data:/Bunny.gltf";
}
</pre>

it will fail with PHP error

PHP Fatal error:  Uncaught Error: Call to undefined function create_function() in ...

Please upgrade version on https://wordpress.org/plugins/wp-syntax/ , as I guess the issue will impact more and more users as they upgrade to PHP 8. Debian stable (bookworm) comes now with PHP 8.2.

shazahm1 commented 10 months ago

Fixed in release 1.2.