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

[3.10][PHP 8.1] Remove properties of legacy extension class (#37035) #37074

Merged
merged 1 commit into from Mar 17, 2022

Conversation

ManuelHu
Copy link
Contributor

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

  1. Install Joomla 3.10.x on a host with PHP 8.1 or any lower version, use template protostar.
  2. Try to access a non-existing page on the frontend while running PHP 8.1, see no 404 error page
  3. Apply this patch
  4. Try again with (still with PHP 8.1), a 404 page should show as expected.

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

@zero-24
Copy link
Contributor

zero-24 commented Feb 16, 2022

Thanks you @ManuelHu will take later a look here on the older PHP versions too.

@zero-24 zero-24 added this to the Joomla 3.10.7 milestone Feb 16, 2022
@ManuelHu
Copy link
Contributor Author

Any news @zero-24?

@zero-24
Copy link
Contributor

zero-24 commented Mar 17, 2022

Hi @ManuelHu I'm sorry I have not been able to check this one yet but will do so now. Can you please check whether you get a "Update branch" button here:

image

Usually it should show to me too but it does not here for some reason.

@zero-24
Copy link
Contributor

zero-24 commented Mar 17, 2022

Ah could be that you have not allowed maintainer edit
image

@Quy Quy added the PHP 8.x PHP 8.x deprecated issues label Mar 17, 2022
@zero-24
Copy link
Contributor

zero-24 commented Mar 17, 2022

Will merge here as I have just tested the change on PHP 5.3.10 which also has the variables declared :)

@zero-24 zero-24 merged commit 600f700 into joomla:3.10-dev Mar 17, 2022
@zero-24
Copy link
Contributor

zero-24 commented Mar 17, 2022

Thanks @ManuelHu and sorry that it took so long to get back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP 8.x PHP 8.x deprecated issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants