Several "Undefined array key" warnings while editing pages
PHP: 8.2.8 DokuWiki: 2023-04-04a "Jack Jackrum"
After installing the newest version of the ckgedit plugin, I encounter the error messages
Warning: Undefined array key 1 in C:\inetpub\wwwroot\dokuwiki\lib\plugins\ckgedit\action\save.php on line 224
Warning: Undefined array key 1 in C:\inetpub\wwwroot\dokuwiki\lib\plugins\ckgedit\action\save.php on line 224
Warning: Cannot modify header information - headers already sent by (output started at C:\inetpub\wwwroot\dokuwiki\lib\plugins\ckgedit\action\save.php:224) in C:\inetpub\wwwroot\dokuwiki\inc\common.php on line 1840
after every save that involves a change of the page. If I edit and save a page without changing its content, no error occurs. These messages appear in a new blank screen. These errors also get shown if I want to change to the "DW Edit" mode. Although these error messages appear, after a refresh or by going back a page it does what I want. But it does not seem to be right that it shows me these messages. And it only shows me these after the installation of this plugin. Before the installation, I was able to edit pages without problems. I get the errors with and without saving with a summary as I thought that this might be a cause.
Also, after getting in the "DW Edit" mode it shows me the errors
Warning: Undefined array key "fck_preview_mode" in C:\inetpub\wwwroot\dokuwiki\lib\plugins\ckgedit\action\meta.php on line 390
Warning: Undefined array key "fck_preview_mode" in C:\inetpub\wwwroot\dokuwiki\lib\plugins\ckgedit\action\meta.php on line 402
immediately as shown here:
Changing from "DW Edit" to "CKG Edit" works without showing an error.
Adding ?do=check on the page that I am testing on results in this output:
More than 32MB RAM (128 MB) available.
Changelog is writable
conf directory is writable
mb_string extension not available - PHP only replacements will be used
Your locale C seems not to be a UTF-8 locale, you should fix this if you encounter problems.
Debugging support is disabled
You are currently logged in as ***
You are part of the groups user
Your current permission for this page is 8
The current page is writable by the webserver
The current page is writable by you
The search index seems to be working
Server time seems to be okay. Diff: 0s
workaround is to wrap variables in isset function.
e.g:
\lib\plugins\ckgedit\action\save.php on line 224
this:
if($link[1]) {
to this:
if(isset($link[1])) {
I edited it in a few places (save.php, admin.php, meta.php, mediamanager.php) and ckgedit works fine.
@turnermm this patch should be released (IMHO).
@turnermm we are interested in fix too.
Thread about this problem on dokuwiki forum: https://forum.dokuwiki.org/d/22498-ckgedit-warning-undefined-array-key-fck-preview-mode