01486: $EnableGUIButtons = 1; causes Internal server error

Summary: $EnableGUIButtons = 1; causes Internal server error
Created: 2022-12-15 17:12
Status: Closed - replied & fixed for 2.3.18
Category: Bug
From: ykaly?
Assigned:
Priority: 3
Version: 2.3.16
OS: RHEL 8 / HTTPD / PHP 7.2.24

Description: I am using the latest pmwiki version and already made some changes but when $EnableGUIButtons is enabled, editing a page always return HTTP ERROR 500.

At first I thought it had something to do with my modifications but I've extracted a new copy of pmwiki and set it to enabled as well and it still throws that error.

Is this a known bug? I am searching PITS but I cannnot see this. There are no answers helpful on other reported issue about it. ykaly?

No, it is not a known bug, a standard 2.3.16 installation works fine with $EnableGUIButtons. What does the PHP error log say? If you upgraded from an earlier version, I'd triple-check if pmwiki.php and all files in the scripts/ directory have been fully updated, as well as those in the directory pub/guiedit/. A 500 error may appear if there is a syntax error in some file, for example forgetting the semicolon after $EnableGUIButtons = 1; or after a button definition. See Troubleshooting#track-errors on how to track this. The other possibility is a call to an undefined function which might happen if you have both new and old files in the scripts/ directory, or if your PHP has some function disabled. In both cases there may be some indication in the PHP error log. I'd also check the file permissions - some servers show Error 500 if your files have too lax, or too restrictive permissions. --Petko

PHP before version 8.0 may need to manually enable the JSON extension. guiedit.php calls json_encode() which was recently added to scripts/guiedit.php. --Petko

Installing php-json solved my problem as what is stated above due to using PHP version 7.2 which JSON extension is not enabled by default. --ykaly?

Thanks for confirming. For PmWiki 2.3.18, I wrote a replacement function for json_encode() that should correctly output the edit buttons, and the other core helper functions (table of contents, CustomSyntax). --Petko