Skip to content

Conversation

@brianteeman
Copy link
Contributor

@brianteeman brianteeman commented Jul 25, 2025

Summary of Changes

$limitstart is passed as the second parameter to array_slice(). If $limitstart is null, it triggers the deprecation warning because array_slice() expects an integer for $offset.

Testing Instructions

npx cypress run --spec '.\tests\System\integration\administrator\components\com_installer\'

check php error_log

Actual result BEFORE applying this Pull Request

PHP Deprecated: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in administrator\components\com_installer\src\Model\InstallerModel.php on line 129

Expected result AFTER applying this Pull Request

this deprecated entry in the logs is resolved

note: there are other deprecation notices about tobscure see joomla-backports/json-api-php#4

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

[25-Jul-2025 08:59:35 UTC] PHP Deprecated:  array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in D:\repos\j51\administrator\components\com_installer\src\Model\InstallerModel.php on line 129

npx cypress run --spec '.\tests\System\integration\administrator\components\com_installer\'

Signed-off-by: BrianTeeman <[email protected]>
Copy link
Member

@richard67 richard67 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the time for a test now, but by review it looks pretty right.

@hans2103
Copy link
Contributor

@brianteeman sorry... Not able to test this.
Haven't worked with Cypres before and I get the followig

$ npx cypress run --spec '.\tests\System\integration\administrator\components\com_installer\'

DevTools listening on ws://127.0.0.1:55037/devtools/browser/14649bfd-0974-426f-b1ff-1fe4e532f79e
Can't run because no spec files were found.

We searched for specs matching this glob pattern:

  > /Users/hans2103/Development/Sites/joomla/public_html/.\tests\System\integration\administrator\components\com_installer\

@muhme
Copy link
Contributor

muhme commented Jul 26, 2025

Haven't worked with Cypres before and I get the followig

@hans2103 Thank you for trying to run Cypress-based System Tests 🚀

  • System Tests are documented in detail in https://github.com/joomla/joomla-cms//blob/HEAD/tests/System
  • Brian has given a directory; to run all test specifications in that directory, you can use a pattern like:
    npx cypress run --spec 'tests/System/integration/administrator/components/com_installer/*.cy.js'
    (And it looks like, you are using an Unix-based system, therefore use slashes / instead of back slashes \)
  • I see old PHP Deprecated: array_slice() entries in my PHP error_log, but I do not see PHP Deprecated: array_slice() from running these two System Tests specifications
  • Also tried to enable Log Deprecated API, but do not see any array_slice deprecation messages in administrator/logs/deprecated.php file

@brianteeman Could you please adjust/extend the test description?

@brianteeman
Copy link
Contributor Author

No idea why you dont see the php error log entries - you should check your php logging and error reporting settings

This was deprecated in php 8.1 https://www.php.net/manual/en/migration81.deprecated.php

You wont see them in the Log Deprecated API log as that is for Joomla deprecations NOT php deprecations

https://www.google.com/search?q=array_slice()%3A+Passing+null&rlz=1C1GCEA_enGB1098GB1098&sourceid=chrome&ie=UTF-8

@ceford
Copy link
Contributor

ceford commented Jul 27, 2025

I have been testing this PR and I get four tests passed.

       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  FromUrl.cy.js                            00:12        2        2        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  Languages.cy.js                          00:02        2        2        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        00:14        4        4        -        -        -  

However, there is no php error log created. I have tried with php8.3 and php8.4. I know this is something to do with my Apache/PHP installation on Mac but I do not know what. Thinking...


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45778.

@muhme
Copy link
Contributor

muhme commented Jul 28, 2025

However, there is no php error log created.

for my local installation it is:

macOS $ php -i | grep error_log
error_log => /usr/local/var/log/php_errors.log => /usr/local/var/log/php_errors.log

@richard67
Copy link
Member

Setting RTC as we have 2 approvals by experienced maintainers, and it is a no-brainer.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45778.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 4, 2025
@muhme
Copy link
Contributor

muhme commented Aug 5, 2025

Final test before merge:

  • I am not able to reproduce the problem, not even on Windows Laragon, where given directory is sufficient to run the Cypress tests inside
  • I tried different installations with module, language or updating the system without ever see the deprecation (but see the deprecation in old PHP error log entries)
  • Since the code change is simple to set limitstart to 0 for null, false or '' it is ok

@muhme muhme merged commit ce9161c into joomla:5.4-dev Aug 5, 2025
40 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 5, 2025
@muhme muhme added this to the Joomla! 5.4.0 milestone Aug 5, 2025
@muhme
Copy link
Contributor

muhme commented Aug 5, 2025

Thank you @brianteeman for your contribution. Thank you @richard67, @hans2103, @ceford and @rdeutz for supporting this PR.

@brianteeman brianteeman deleted the limitstart branch August 5, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants