webcalendar
webcalendar copied to clipboard
Can't change settings in latest master
When trying to edit the settings in the admin on the latest master version, I get "Fatal Error: Invalid form request". No errors are written to the screen.
These are from the log:
PHP Warning: Undefined variable $_SESSION in /cal/includes/formvars.php on line 47
PHP Warning: Trying to access array offset on value of type null in /cal/includes/formvars.php on line 47
PHP Warning: Undefined variable $myusers in /cal/edit_entry.php on line 1051
PHP Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given in /cal/category.php:17
Stack trace:
#0/cal/category.php(17): fclose(false)
#1 {main}
thrown in/cal/category.php on line 17
PHP Warning: Undefined variable $users in /cal/layers.php on line 167
Even after adding
error_reporting(E_ALL);
ini_set('display_errors', 1);
to /includes/init.php and making sure display_errors = On
in the ini file, that's all I see in the browser. How can we get errors to be written to the screen while testing?
Marc
PHP 8.0.16 Apache 2.4
I don't understand the first error "Undefined variable $_SESSION". If you've already logged in (since you are on the admin page), the $_SESSION variable should exist and be accessible from anywhere in the code.
I don't know if I'm actually "logged in". I'm never asked to log in when I access the settings pages.
If I could get this script to display actual errors on the screen, I could help out a lot more.
Check and see if you have a "wc-icons" directory and if it is world-writable. The fatal error on fclose is checking to see if the server can write to that directory.
So, it looks like you were trying to access the System Settings page (and got warnings) and also the Categories page (which got the fatal error).
Do you have your install setup as single-user? Anything else unusual about your setup?
I'm using the pre-release 1.9.1 from the Releases page. Current PHP version 7.4.29 with Apache 2.4.37 from RHEL repositories.
When trying to change the settings I get the same error Fatal Error: Invalid form request
and in my error log this is written:
[20-Apr-2022 12:12:09 Europe/Berlin] PHP Notice: Undefined variable: _SESSION in /var/www/username/html/k5nbeta/includes/formvars.php on line 47
[20-Apr-2022 12:12:09 Europe/Berlin] PHP Notice: Trying to access array offset on value of type null in /var/www/username/html/k5nbeta/includes/formvars.php on line 47
I added these two lines to the formvars.php
script before die_miserable_death()
is called:
var_dump($_SESSION);
var_dump($formKey);
The output is:
NULL string(64) "6e7e3d3eba2836c818d3def890c08404168a0f29e1c18594307840ce7dfb3284"
Indeed it seems like $_SESSION
is not set.
This is a fresh install with a virgin database and I have used the normal setup process. For authentication I chose "None (single user)". Would be happy to report anything else I can.
Downloaded the latest version and did an upgrade, keeping the old db. Install appeared to go smoothly. (I hope all the modal dialogs get removed that pop up during the install). I then went to change the timezones in the settings. It took, but then the window went black. At first I thought a dark mode had been set, but couldn't get out of it. Most all links and input fields were obscured by the black background.
So I deleted the db and the settings.php to do a clean install. Then I got these errors:
Warning: Undefined array key "user_inc" in /home/user/www/cal/install/index.php on line 1560
Warning: Undefined array key "user_inc" in /home/user/www/cal/install/index.php on line 1565
Warning: Undefined array key "user_inc" in /home/user/www/cal/install/index.php on line 1571
Warning: Undefined array key "user_inc" in /home/user/www/cal/install/index.php on line 1577
Warning: Undefined array key "user_inc" in /home/user/www/cal/install/index.php on line 1580
Warning: Undefined array key "readonly" in /home/user/www/cal/install/index.php on line 1596
Warning: Undefined array key "readonly" in /home/user/www/cal/install/index.php on line 1599
I have the same issue when saving system settings. We use http auth. It looks like session_start() is not being called in this case. I can't quite tell where it is supposed to happen (WebCalendar._initValidate
?), but if I add a call to @session_start();
in the preventHacking()
function, I can save settings.
However we are also having a similar issue with edit_entry_handler.php. With the change here the session is restored but the form validation is failing because of a csrf_form_key
mismatch (#292 perhaps?)
I have the same issue:
Undefined variable $_SESSION in /cal/includes/formvars.php on line 47
when using the app in mode
single_user = true
Formvars.php refers to a session, which is not created in
WebCalendar.php
in single user mode.
Would it be a solution to add the following lines in Webcalendar.php
_initValidate function
if ( $single_user == 'Y' ){ $login = $single_user_login; @session_start(); $_SESSION['webcal_login'] = $login; $_SESSION['webcalendar_session'] = $webcalendar_session; }
as it works for me.
I am hitting the same thing with Webcalendar built in authorization. I am not in single user mode. Also, I am using php-fpm 8.1.12.
I am cleaning up a number of little issues that result in a number of error messages. Fortunately, 1 change fixes 20-30 message.
I believe this was due to WebCalendar not properly supporting PHP 8 at the time. Give v.1.9.8 a try.