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

PHP 8 support (closes #23) #26

Merged
merged 58 commits into from
Sep 19, 2022
Merged

PHP 8 support (closes #23) #26

merged 58 commits into from
Sep 19, 2022

Conversation

gregstoll
Copy link
Owner

This updates the code to support PHP 8. Note that it's worked for everything I've tried on my local install, but it's definitely possible there are more problems lurking - feel free to open issues as you find them!

Categories of stuff fixed in this PR:

  • Instance methods can no longer be called with a static syntax (i.e. ClassName::instanceMethod()) - this is mentioned here but I can't find the original deprecation notice. This has been deprecated for a while but now it returns an error. Made a bunch of methods static to fix this. In some cases a method was called with an instance syntax some places and a static syntax others, so I had to make two separate functions. (for example commit 7e768be)
  • Curly braces can no longer be used to index into arrays and strings - see deprecation notice. Fix was simple but this was done in a ton of places. (for example commit 5a584b5
  • Constructors used to be able to have the same name as the class but now have to be named __construct() - see deprecation notice. Another simple fix needed in a ton of places. This one was scarier because constructing an object would still work, but the constructor wouldn't be called, which would lead to unpredictable problems later on. I search and tried to make sure to find all of these. (for example commit c30f191)
  • Method prototypes of methods on a subclass have to match the prototype of the parent class's method. (can't find a reference to this) This was mostly a matter of adding an extra parameter (for example commit f00650e, although there was one case where two unrelated methods had the same name and I changed one (GalleryDynamicAlbum::createDynamicAlbum() in commit 5aac894.
  • create_function() no longer works - see deprecation notice. Fix was to use anonymous functions instead. (for example commit 368b772)
  • each() no longer works - see deprecation notice. Fix was to use foreach construct instead. (for example commit 6629937)
  • Ternary operator (i.e. a ? b : c) used to be left-associative and you could nest them without parentheses; now parentheses are required - see deprecation notice. Fix was to add parentheses.

I also fixed a few warnings that were cluttering up the debug output.

@gregstoll gregstoll linked an issue Sep 19, 2022 that may be closed by this pull request
@gregstoll gregstoll merged commit 81d0a3e into master Sep 19, 2022
@gregstoll gregstoll deleted the php8 branch September 25, 2022 01:50
@gregstoll gregstoll mentioned this pull request Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Major problems with PHP 8 on Fedora 35
1 participant