[3.10][PHP 8.1] Remove properties of legacy extension class (#37035) #37074
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #37035 . 404 pages throw a blank page / 500 status code instead of displaying the default 404 page. This is due to a compile time error in the legacy exception class used internally to create the 404 error page.
Summary of Changes
The legacy extension class re-declares properties already declared in PHP's default exception class.
Starting with PHP 8.1, all the protected properties got type hints in the upstream definition and thus cannot be redeclared without specifying type hints in the overriding class. Adding those type hints would be of course no viable solution, as this is not possible with php 5.x (no type hint support) and would even be a compile time error on all PHP versions up to PHP 8.0.
(This is a b/c break between PHP 8.0 and 8.1, though this should not occur between two minor versions. In the relevant discussion on the PHP mailing list, the re-declaration of already defined core properties was just defined as unsupported...)
Removing the re-declared properties from Joomla's legacy exception class should fix the issue. After some research, this fix should work on all PHP versions supported by Joomla 3.10, but I did not test old PHP versions manually.
Testing Instructions
Actual result BEFORE applying this Pull Request
Accessing a non-existent page in the frontend displays a white page / 500 error instead of a 404 page.
Expected result AFTER applying this Pull Request
Accessing a non-existent page in the frontend displays a standard 404 page.
Documentation Changes Required