Skip to content

Conversation

@heelc29
Copy link
Contributor

@heelc29 heelc29 commented Oct 1, 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

@HLeithner
Copy link
Member

HLeithner commented Oct 4, 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.

@HLeithner HLeithner added the bug label Oct 4, 2025
@richard67
Copy link
Member

why we prove a NULL here.

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

@HLeithner
Copy link
Member

updated my comment

@heelc29
Copy link
Contributor Author

heelc29 commented Oct 9, 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

@heelc29 heelc29 mentioned this pull request Oct 15, 2025
4 tasks
@HLeithner
Copy link
Member

thanks

@Fedik Fedik added the PHP 8.x PHP 8.x deprecated issues label Oct 16, 2025
@muhme
Copy link
Contributor

muhme commented Oct 16, 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

@muhme muhme merged commit 7df622b into joomla:5.4-dev Oct 16, 2025
40 checks passed
@muhme muhme added this to the Joomla! 5.4.1 milestone Oct 16, 2025
@muhme
Copy link
Contributor

muhme commented Oct 16, 2025

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

@heelc29 heelc29 deleted the 5.4/php85/abstractmenu branch November 1, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug PHP 8.x PHP 8.x deprecated issues PR-5.4-dev

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants