PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar brianteeman
brianteeman
30 Aug 2023

Pull Request for Issue #38876 .

Summary of Changes

some hosts disable set_time_limit in php

Prior to PHP 8.0.0, it was possible for the @ operator to disable critical errors that will terminate script execution. For example, prepending @ to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why.

This PR replaces the @ with a function_exists check

Testing Instructions

code review or in php.ini
disable_functions = set_time_limit

Actual result BEFORE applying this Pull Request

Admin dashboard loads with an error
finder index ends with an error

Expected result AFTER applying this Pull Request

everything works

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

avatar joomla-cms-bot joomla-cms-bot - change - 30 Aug 2023
Category Administration com_finder Libraries
avatar brianteeman brianteeman - open - 30 Aug 2023
avatar brianteeman brianteeman - change - 30 Aug 2023
Status New Pending
avatar richard67
richard67 - comment - 30 Aug 2023

@brianteeman As this PR is for 4.4-dev: Have you checked if it works with PHP 7.4? I'm asking because of this info I get from here https://php.watch/versions/8.0/disable_functions-redeclare , especially the last sentence :

function_exists() returns false for disabled functions
function_exists() function now returns false for functions disabled with disable_functions INI directive. This is because internally, disabled functions do not even make to the internal functions table.
Prior to PHP 8, to check if a function is disabled, one would need to query the INI setting, or use the return value of get_defined_functions() function.

Could you check?

avatar brianteeman
brianteeman - comment - 30 Aug 2023

@richard67 I assume it works otherwise we have a problem with the existing use

// Let's try to avoid time-outs
if (\function_exists('set_time_limit')) {
set_time_limit(0);

avatar brianteeman
brianteeman - comment - 30 Aug 2023

I just retested this PR with php 7.4.9 and set_time_limit disabled and no problems

avatar richard67
richard67 - comment - 30 Aug 2023

I just retested this PR with php 7.4.9 and set_time_limit disabled and no problems

Ok, thanks for checking.

avatar brianteeman brianteeman - change - 1 Sep 2023
Labels Added: PR-4.4-dev
avatar Quy Quy - test_item - 1 Sep 2023 - Tested successfully
avatar Quy
Quy - comment - 1 Sep 2023

I have tested this item ✅ successfully on 2daf4cf


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

avatar richard67
richard67 - comment - 2 Sep 2023

Is there a reason why this PR is made for 4.4-dev and not 4.3-dev? To me it seems to be a bug fix.

avatar brianteeman
brianteeman - comment - 2 Sep 2023

No reason

avatar laoneo
laoneo - comment - 7 Sep 2023

Do we have to copy the changes to the framework package as well @Hackwar?

avatar wilsonge
wilsonge - comment - 7 Sep 2023

Would be good to get this in the framework file system too if it’s effected but it’s not a hard requirement

avatar laoneo
laoneo - comment - 8 Sep 2023

@brianteeman are able to add the checks also to the framework package?

avatar brianteeman
brianteeman - comment - 8 Sep 2023

i will look at the framework now and do a pr there if needed as well

avatar brianteeman
brianteeman - comment - 8 Sep 2023

@wilsonge @laoneo I already did the framework changes last week at the same time I did this joomla-framework/filesystem#59

but it was rubbish so i did itagain joomla-framework/filesystem#60

avatar laoneo laoneo - change - 8 Sep 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-09-08 12:17:54
Closed_By laoneo
avatar laoneo laoneo - close - 8 Sep 2023
avatar laoneo laoneo - merge - 8 Sep 2023
avatar laoneo
laoneo - comment - 8 Sep 2023

Thanks!

Add a Comment

Login with GitHub to post a comment