turnermm / Updatable-Snippets-for-Dokuwiki

Inserts updatable snippets into Dokuwiki pages
https://dokuwiki.org/plugin:snippets
GNU General Public License v2.0
6 stars 4 forks source link

Call to undefined function create_function() #45

Closed robertnormanhiggins closed 2 years ago

robertnormanhiggins commented 2 years ago

Call to undefined function create_function() error when trying to create the snippets page. Apparently: The function create_function() was deprecated in PHP 7.2 and removed in PHP 8.0.0.

I had to uninstall the Snippets extension to be able to create any pages again.

How can I fix this? I there a new create function to put in the snippet php ?

turnermm commented 2 years ago

I have about 40 plugins and had tried to catch all of these. I'll make the change as soon as I can. It would help if you had a line number and filename

turnermm commented 2 years ago

I was able to make the change. Could you download the update and test:

PHP 8.0 update

Thanks

Whyglobaleyes commented 2 years ago

Hello, I've just come across the same problem.

Is the main plugin package updated or do you think I need to manually install the update patch above ? If so then please could you link me to an idiots guide about how to do that please?

many thanks in advance

turnermm commented 2 years ago

The plugin can now be safely downloaded from the extension manager. It contains the 8.0 fix.

Whyglobaleyes commented 2 years ago

Thanks for your really really quick reply.

In that case I think there must be something else wrong. The error started coming up after I installed the latest update to the main dw package. The error log is:

2022-10-07 10:29:36
Error: Call to undefined function create_function()
/config/dokuwiki/lib/plugins/snippets/action.php(100)
#0 /app/www/public/inc/Extension/EventHandler.php(81): action_plugin_snippets->handle_template()
#1 /app/www/public/inc/Extension/Event.php(96): dokuwiki\Extension\EventHandler->process_event()
#2 /app/www/public/inc/common.php(1089): dokuwiki\Extension\Event->advise_after()
#3 /app/www/public/inc/Action/Edit.php(65): pageTemplate()
#4 /app/www/public/inc/ActionRouter.php(83): dokuwiki\Action\Edit->preProcess()
#5 /app/www/public/inc/ActionRouter.php(48): dokuwiki\ActionRouter->setupAction()
#6 /app/www/public/inc/ActionRouter.php(60): dokuwiki\ActionRouter->__construct()
#7 /app/www/public/inc/actions.php(16): dokuwiki\ActionRouter::getInstance()
#8 /app/www/public/doku.php(126): act_dispatch()
#9 {main}

Any ideas please?

turnermm commented 2 years ago

https://github.com/turnermm/Updatable-Snippets-for-Dokuwiki/blob/master/action.php

If you link to the above page and scroll down to line 100, you will see that at line 100 there is no reference to the old create_function('$v'. It has been replaced by function($v).

Try reinstalling, using the extension maanager.

Whyglobaleyes commented 2 years ago

Wow! Thank you - all working now. Looks like I missed an update in the alst few days!

Thank you again for a brilliant, essential plugin! I missed it so badly for even the 3days I messed it up