turnermm / ckgedit

CKEditor integrated into Dokuwiki
https://www.dokuwiki.org/plugin:ckgedit
GNU General Public License v2.0
60 stars 49 forks source link

incompatibility with PHP 8.0 #653

Closed renatopancheri closed 2 years ago

renatopancheri commented 2 years ago

Hi,

running dokuwiki with PHP 8.0 i get this error:

PHP Fatal error: Uncaught Error: Call to undefined function create_function() in /var/www/local_https/dokuwiki/lib/plugins/ckgedit /action/edit.php:229 Stack trace: #0 /var/www/local_https/dokuwiki/lib/plugins/ckgedit/action/edit.php(174): action_plugin_ckgedit_edit->_preprocess() #1 /var/www/local_https/dokuwiki/inc/Extension/EventHandler.php(81): action_plugin_ckgedit_edit->ckgedit_edit() #2 /var/www/local_https/dokuwiki/inc/Extension/Event.php(72): dokuwiki\Extension\EventHandler->process_event() #3 /var/www/local_https/dokuwiki/inc/Extension/Event.php(128): dokuwiki\Extension\Event->advise_before() #4 /var/www/local_https/dokuwiki/inc/Extension/Event.php(195): dokuwiki\Extension\Event->trigger() #5 /var/www/local_https/dokuwiki/inc/template.php(84): dokuwiki\Extension\Event::createAndTrigger() #6 /var/www/local_https/dokuwiki/lib/tpl/dokuwiki/main.php(59): tpl_content() #7 /var/www/local_https/dokuwiki/inc/actions.php(27): include('...') #8 /var/www/local_https/dokuwiki/doku.php(122): act_dispatch() #9 {main}

looks like create_function has been deprecated in PHP 7.2 and dropped in PHP 8.0: https://www.php.net/manual/en/function.create-function.php

i've found this repository: https://github.com/lombax85/create_function from a guy that re-created this function for PHP8, i literally copy pasted the helper.php in a file and added: require_once(DOKU_INC . 'lib/plugins/ckgedit/create_function.php'); at the start of helper.php and it seems to work fine

turnermm commented 2 years ago

The conversion from create_function to anonymous function is ongoing, in the anon_func branch. There are many instances, and each has to be tested.

turnermm commented 2 years ago

The anon_func branch should now be completed. Perhaps you can try it out. Since there were so many changes, it would be helpful to have it tested before integrating it into the main distribution.

https://github.com/turnermm/ckgedit/archive/refs/heads/anon_func.zip