? ? Pending

User tests: Successful: Unsuccessful:

avatar ManuelHu
ManuelHu
16 Feb 2022

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

avatar ManuelHu ManuelHu - open - 16 Feb 2022
avatar ManuelHu ManuelHu - change - 16 Feb 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Feb 2022
Category Libraries
avatar zero-24
zero-24 - comment - 16 Feb 2022

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

avatar ManuelHu
ManuelHu - comment - 12 Mar 2022

Any news @zero-24?

avatar zero-24
zero-24 - comment - 17 Mar 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.

avatar zero-24
zero-24 - comment - 17 Mar 2022

Ah could be that you have not allowed maintainer edit
image

avatar zero-24
zero-24 - comment - 17 Mar 2022

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

avatar zero-24 zero-24 - change - 17 Mar 2022
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-03-17 17:26:05
Closed_By zero-24
Labels Added: ? ?
avatar zero-24 zero-24 - close - 17 Mar 2022
avatar zero-24 zero-24 - merge - 17 Mar 2022
avatar zero-24
zero-24 - comment - 17 Mar 2022

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

Add a Comment

Login with GitHub to post a comment