PHP 8.x bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar heelc29
heelc29
1 Oct 2025

Summary of Changes

Deprecated: Using null as an array offset is deprecated, use an empty string instead

https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists

Testing Instructions

Open frontend and open login form index.php/component/users/login

  • enable max error reporting
  • use php 8.5 (latest pre-version 8.5.0rc1)

Actual result BEFORE applying this Pull Request

deprecation message (possibly further)
image

image

Expected result AFTER applying this Pull Request

no deprecation message about using null as an array offset from AbstractMenu.php

Link to documentations

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar heelc29 heelc29 - open - 1 Oct 2025
avatar heelc29 heelc29 - change - 1 Oct 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Oct 2025
Category Libraries
avatar HLeithner
HLeithner - comment - 4 Oct 2025

Strange, based on the method docblock it's not allowed to provide NULL, I would prefere a user deprecation warning and check why we provide a NULL here.

avatar richard67
richard67 - comment - 5 Oct 2025

why we prove a NULL here.

@HLeithner Did you mean "provide" instead of "prove"?

avatar HLeithner
HLeithner - comment - 5 Oct 2025

updated my comment

avatar heelc29 heelc29 - change - 9 Oct 2025
Labels Added: bug PR-5.4-dev
avatar joomla-cms-bot joomla-cms-bot - change - 9 Oct 2025
Category Libraries Libraries Modules Front End
avatar heelc29 heelc29 - change - 9 Oct 2025
The description was changed
avatar heelc29 heelc29 - edited - 9 Oct 2025
avatar heelc29
heelc29 - comment - 9 Oct 2025

I would prefere a user deprecation warning

Do you mean something like this. What should the target version be?

  • 6.1 because new "soft" deprecation
  • 5.4 because it's a bugfix to prevent php deprecation warning
 /**
  * Get menu item by id
  *
  * @param   integer  $id  The item id
  *
  * @return  MenuItem|null  The item object if the ID exists or null if not found
  *
  * @since   1.5
  */
 public function getItem($id)
 {
     $result = null;
 
+    if ($id === null) {
+        @trigger_error(\sprintf('The value for $id must not be null in %s', __METHOD__), E_USER_DEPRECATED);
+
+        return $result;
+    }
+
     if (isset($this->getMenu()[$id])) {
         $result = &$this->getMenu()[$id];
     }
 
     return $result;
 }

and check why we provide a NULL here.

done, see c160acd and 7b7a351

avatar HLeithner
HLeithner - comment - 15 Oct 2025

thanks

avatar muhme muhme - change - 16 Oct 2025
Labels Added: PHP 8.x
avatar muhme
muhme - comment - 16 Oct 2025

✅ Tested with JBT php8.5-rc

  • Before patch 2 Deprecated seen in 'index.php/component/users/login'
  • After graft full package no Deprecated in 'Login Form', login and logout are still working
  • Switched to php8.1 and checked login and logout are still working
avatar muhme muhme - close - 16 Oct 2025
avatar muhme muhme - merge - 16 Oct 2025
avatar muhme muhme - change - 16 Oct 2025
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2025-10-16 15:52:35
Closed_By muhme
avatar muhme
muhme - comment - 16 Oct 2025

Thank you @heelc29 for your contribution. Thank you @HLeithner for your support.

Add a Comment

Login with GitHub to post a comment