webcalendar icon indicating copy to clipboard operation
webcalendar copied to clipboard

Can't change settings in latest master

Open s22-tech opened this issue 2 years ago • 7 comments

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

s22-tech avatar Mar 16 '22 19:03 s22-tech

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.

craigk5n avatar Mar 17 '22 17:03 craigk5n

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.

s22-tech avatar Mar 17 '22 17:03 s22-tech

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).

craigk5n avatar Mar 17 '22 17:03 craigk5n

Do you have your install setup as single-user? Anything else unusual about your setup?

craigk5n avatar Mar 17 '22 17:03 craigk5n

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.

salixh5 avatar Apr 20 '22 10:04 salixh5

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

s22-tech avatar May 01 '22 04:05 s22-tech

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?)

darrinsmart avatar Jul 27 '22 22:07 darrinsmart

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.

BibliothekTHWildau avatar Apr 27 '23 18:04 BibliothekTHWildau

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.

BibliothekTHWildau avatar Apr 27 '23 18:04 BibliothekTHWildau

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.

Grover-D avatar May 19 '23 21:05 Grover-D

I believe this was due to WebCalendar not properly supporting PHP 8 at the time. Give v.1.9.8 a try.

craigk5n avatar Sep 13 '23 20:09 craigk5n