beestat / app

The actual beestat app.
https://beestat.io
GNU General Public License v3.0
202 stars 15 forks source link

Creation of dynamic property is deprecated in PHP 8.2+, which breaks shutdown handler and therefore error reporting #409

Open SriRamanujam opened 4 months ago

SriRamanujam commented 4 months ago

Describe the bug So I'm trying to stand up a self-hosted beestat, both for running it and for potentially contributing to it in the future. Thank you so much for your hard work on this project, I'm looking forward to using it :D

I attempted to stand things up in a Docker container using the php:8.3-apache image. This is how I encountered this issue. This bug report is more of a heads-up, rather than something currently broken.

The codebase makes heavy use of dynamic properties, which are deprecated in PHP 8.2+. This deprecation gets flagged as an error due to the error_reporting setting (I believe? It's been a few years since I've worked with PHP), which is fine.

But then the shutdown handler tries to set a dynamic property as well, which then completely blows up the whole thing and I get a empty page with no error data whatsoever.

Other notes: The self-hosting docs don't make mention of which PHP version to use, it just says PHP 8. I admit to swinging for the fences a bit with PHP 8.3 since Jammy only has 8.1, but hey, nothing ventured nothing gained right?

To Reproduce

  1. Stand up the app using PHP 8.2 or newer.
  2. Browse to the homepage.
  3. Observe a blank page (empty html) with no error data returned in server logs or on the page itself.

Screenshots Screenshot from my VS Code showing the error and trace, since there's no other way to get it

image

ziebelje commented 4 months ago

Appreciate the detailed report! I suppose the appropriate fix is to declare these properties...probably quite a few that need done. For now I updated the documentation to specify 8.1. I try to keep things reasonably up-to-date, so I'm sure I'll get to this eventually.

Let me know if you have any other issues getting this up and running.