Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookworm Web Interface 403 #2128

Merged
merged 4 commits into from
Dec 2, 2023

Conversation

AlvinSchiller
Copy link
Collaborator

If v2 is installed on Bookworm, on calling the Webinterface it results in a "403 Forbidden".

Setting the executable right for others on the home folder fixes this. Seems that opening a subfolder (htdocs) needs this permissions since Bookworm.

This was also introduced for nginx in V3

# make sure nginx can access the home directory of the user
sudo chmod o+x /home/pi

Additionally fixed deprecation warnings for "mod_compress"

@coveralls
Copy link

coveralls commented Nov 27, 2023

Pull Request Test Coverage Report for Build 7066491871

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 76.82%

Totals Coverage Status
Change from base Build 6991409517: 0.0%
Covered Lines: 633
Relevant Lines: 824

💛 - Coveralls

@AlvinSchiller
Copy link
Collaborator Author

AlvinSchiller commented Nov 27, 2023

On Bookworm there is another Problem with the "Folders and Files" Tab.
The UI Elements for creating a folder and Upload are not present.
Screenshot 2023-11-27 132826

I narrowed it down to this code lines, but not firm enough with php to see a quick fix (and whats the intention)

if (array_key_exists($fpost['cardID'], $shortcuts)) {
$fpost['folder'] = $shortcuts[$fpost['cardID']];
}

If the lines are removed, the page is loaded correctly and seems also to behave correct.

@s-martin @pabera any idea?

@AlvinSchiller AlvinSchiller added this to the 2.5 milestone Nov 27, 2023
@AlvinSchiller
Copy link
Collaborator Author

AlvinSchiller commented Nov 27, 2023

ok maybe just a copy paste bug from the CardID UI (dont see why cardid and shortcut should be relevant in this UI) ?

// check if we can preselect an audiofolder if NOT a foldername was posted
if(! isset($fpost['audiofolder']) OR trim($fpost['audiofolder']) == "") {
if(array_key_exists($fpost['cardID'], $shortcuts)) {
$fpost['audiofolder'] = $shortcuts[$fpost['cardID']];
}
}

strange it runs prior bookworm without a fault.

@s-martin
Copy link
Collaborator

s-martin commented Dec 1, 2023

[...]

I narrowed it down to this code lines, but not firm enough with php to see a quick fix (and whats the intention)

if (array_key_exists($fpost['cardID'], $shortcuts)) {
$fpost['folder'] = $shortcuts[$fpost['cardID']];
}

If the lines are removed, the page is loaded correctly and seems also to behave correct.

@s-martin @pabera any idea?

Do we have some git blame info?

@AlvinSchiller
Copy link
Collaborator Author

Do we have some git blame info?

Nope. Was this way from the very beginning

@AlvinSchiller
Copy link
Collaborator Author

AlvinSchiller commented Dec 1, 2023

strange it runs prior bookworm without a fault.

Ok i found why it behaves different on Bookworm.

  • Bullseye runs PHP 7.x.
  • Bookworm runs PHP 8.x,

There are a few incompatible changes (https://www.php.net/manual/en/migration80.incompatible.php) and this one strikes here

  • The behavior of array_key_exists() regarding the type of the key parameter has been made consistent with isset() and normal array access. All key types now use the usual coercions and array/object keys throw a TypeError.

I now checked the error logs (/var/log/lighttpd/error.log) for both versions:
bullseye:

...
2023-12-02 00:07:12: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice:  Undefined variable: fpost in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
2023-12-02 00:07:12: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice:  Trying to access array offset on value of type null in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
2023-12-02 00:07:12: mod_fastcgi.c.487) FastCGI-stderr:PHP Notice:  Undefined variable: shortcuts in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
2023-12-02 00:07:12: mod_fastcgi.c.487) FastCGI-stderr:PHP Warning:  array_key_exists() expects parameter 2 to be array, unknown given in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
...

bookworm:

...
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:PHP Warning:  Undefined variable $post in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:PHP Warning:  Trying to access array offset on value of type null in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:PHP Warning:  Undefined variable $shortcuts in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:PHP Fatal error:  Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php:283
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:Stack trace:
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:#0 {main}
2023-12-02 00:29:39: (mod_fastcgi.c.449) FastCGI-stderr:  thrown in /home/pi/RPi-Jukebox-RFID/htdocs/manageFilesFolders.php on line 283
...

So it seems it was also not working on bullseye ( ever working? ), but it was just a silent warning.
Just from reading the code i assume it is intended to preselect a folder based on the selected cardid, but the variables are not set and dont even make sense in this context.

My suggestion is to remove the code snippet.

@s-martin
Copy link
Collaborator

s-martin commented Dec 1, 2023

Remove it:)

@AlvinSchiller AlvinSchiller marked this pull request as ready for review December 2, 2023 00:00
@AlvinSchiller AlvinSchiller merged commit 4a190f2 into MiczFlor:develop Dec 2, 2023
33 of 34 checks passed
@AlvinSchiller AlvinSchiller deleted the fix/webinterface branch December 2, 2023 00:17
AlvinSchiller added a commit to AlvinSchiller/RPi-Jukebox-RFID that referenced this pull request Dec 21, 2023
* make homedir executable for lighttp

* fix deprecations lighttp

* removed faulty code (error in php 8.x)

* automatic editorconfig changes (whitespaces)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants