User tests: Successful: Unsuccessful:
Pull Request resolves # .
Use '' if $pk is null
Try to add a new language override.
Deprecated: Using null as an array offset is deprecated, use an empty string instead in administrator\components\com_languages\src\Model\OverrideModel.php on line 135 and 143
No Deprecated warning
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_languages |
this happens on 5.4 as well
this happens on 5.4 as well
I have tested this item ✅ successfully on b98f722
Before: clicking New in Languages → Overrides shows Deprecated: Using null as an array offset at OverrideModel.php:135 and :143.
After: no deprecation. Also tested:
Warning: Undefined array key at line 143 (any PHP 8.x); gone with the PRsave(), line 190: isset($strings[$data['id']]). The admin form always posts &id=, so the UI is fine. A new override via the API (POST /api/index.php/v1/languages/overrides/site/en-GB {"key":"X","override":"y"}) has no id and logs:
Warning: Undefined array key "id" in OverrideModel.php on line 190
Deprecated: Using null as an array offset is deprecated ... on line 190
Fix: $id = $data['id'] ?? ''; and use $id in lines 190–199.$input->get('id', '') ?? '': Input::get() with the default cmd filter never returns null, so ?? '' is redundant. $input->get('id', '') is enough.I have tested this item ✅ successfully on b98f722
Before: clicking New in Languages → Overrides shows Deprecated: Using null as an array offset at OverrideModel.php:135 and :143.
After: no deprecation. Also tested:
Warning: Undefined array key at line 143 (any PHP 8.x); gone with the PRsave(), line 190: isset($strings[$data['id']]). The admin form always posts &id=, so the UI is fine. A new override via the API (POST /api/index.php/v1/languages/overrides/site/en-GB {"key":"X","override":"y"}) has no id and logs:
Warning: Undefined array key "id" in OverrideModel.php on line 190
Deprecated: Using null as an array offset is deprecated ... on line 190
Fix: $id = $data['id'] ?? ''; and use $id in lines 190–199.$input->get('id', '') ?? '': Input::get() with the default cmd filter never returns null, so ?? '' is redundant. $input->get('id', '') is enough.this happens on 5.4 as well
@alikon Right, OverrideModel is the same in 5.4-dev (lines 100/109/117, and 164 in save()), so you get the same messages there on PHP 8.5.
But 5.4 is in security-fix-only mode now. This is a deprecation notice (plus the "Undefined array key" warning) with no functional or security impact, so it doesn't qualify for 5.4. The fix stays in 6.2.
| Labels |
Added:
PR-6.2-dev
|
||
In the save() function the issue cannot occur, as there is always at least an empty string has to be saved.
But to be save ...
I have tested this item ✅ successfully on dee6ed3
Tested with JBT
OverrideModel.php on line 190OverrideModel.php on line 190OverrideModel.php on line 143I have tested this item ✅ successfully on dee6ed3
Tested with JBT
OverrideModel.php on line 190OverrideModel.php on line 190OverrideModel.php on line 143api_call GET /v1/languages/overrides/site/en-GB (if overwrites exist or not), which bis not fixed with this PR
PHP Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/administrator/components/com_languages/src/Model/OverridesModel.php on line 100
(#48630 (comment)) this will never occur.
If the client is not "site" or "admin", then the function breaks with error "wrong filename". But if requested I can ad the fix.
(#48630 (comment)) this will never occur.
If the client is not "site" or "admin", then the function breaks with error "wrong filename". But if requested I can add the fix.
(#48630 (comment)) this will never occur. If the client is not "site" or "admin", then the function breaks with error "wrong filename". But if requested I can add the fix.
Thanks for looking into it, @chmst! And are we looking at two different files? 🙂
OverrideModel.php (single override)OverridesModel.php (list of overrides), line 100:if (strtoupper($this->getState('list.direction')) == 'DESC') {
It’s about the sort direction, not the client. The list.direction is null for this endpoint, and every API list request triggers:
PHP Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in .../OverridesModel.php on line 100
I get this with site and with administrator, with or without existing overrides. Suggested fix in OverridesModel.php, lines 94 and 100:
if (strtoupper((string) $this->getState('list.direction', 'asc')) == 'DESC') {
Since this PR has already two successful tests I’m happy to open a new issue, or you can include it here if you prefer. Thanks again!
I have tested this item ✅ successfully on dee6ed3
Tested this with PHP 8.5.12.1 using Eclipse / Xdebug to listen for PHP deprecation notices.
Prior to patch, when I did New language override the 4 deprecation notices appeared and eclipse stopped 4 times at these lines indicating a deprecation.
I used curl to send a POST without an id, and eclipse stopped at the deprecation on line 190.
After applying the patch no deprecation notices appeared for New language override, and eclipse didn't stop when issuing New or the POST sent from curl.
I have tested this item ✅ successfully on dee6ed3
Tested this with PHP 8.5.12.1 using Eclipse / Xdebug to listen for PHP deprecation notices.
Prior to patch, when I did New language override the 4 deprecation notices appeared and eclipse stopped 4 times at these lines indicating a deprecation.
I used curl to send a POST without an id, and eclipse stopped at the deprecation on line 190.
After applying the patch no deprecation notices appeared for New language override, and eclipse didn't stop when issuing New or the POST sent from curl.
| Status | Pending | ⇒ | Ready to Commit |
RTC
RTC
| Labels |
Added:
RTC
|
||
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-11-06 16:32:14 |
| Closed_By | ⇒ | MacJoom |
Thank you!
this happens on 5.4 as well