The System Information page crashes with a fatal error when the PHP function php_uname() is disabled by the hosting provider.
The page:
Administrator → System → System Information
returns:
Call to undefined function Joomla\Component\Admin\Administrator\Model\php_uname()
The exception originates from:
administrator/components/com_admin/src/Model/SysinfoModel.php
Current code:
'php' => php_uname(),On servers where php_uname() is listed in disable_functions, function_exists('php_uname') returns false.
Because Joomla calls the function without checking its availability, the entire System Information page fails with an HTTP 500 error.
5.4
The System Information page should continue to work even if php_uname() is unavailable.
Instead of throwing a fatal error, Joomla should display a fallback value such as:
The page should never become inaccessible because an optional PHP function has been disabled by the hosting provider.
Opening:
Administrator → System → System Information
results in:
HTTP 500
Error:
Call to undefined function Joomla\Component\Admin\Administrator\Model\php_uname()
The System Information page cannot be displayed.
Joomla Version:
5.4.7
PHP Version:
8.4.20
Web Server:
Apache
Hosting:
Shared Hosting
PHP Configuration:
function_exists('php_uname') returns:
false
The PHP configuration contains:
disable_functions = ... php_uname ...
The issue was reproduced on a production website running Joomla 5.4.7.
I investigated the issue and found that the fatal error is caused by calling php_uname() without first checking whether the function is available.
A simple guard completely fixes the problem.
Current code:
'php' => php_uname(),Suggested implementation:
'php' => function_exists('php_uname')
? php_uname()
: 'Disabled by server',or any equivalent fallback.
Many shared hosting providers disable php_uname() for security reasons. In this situation Joomla should continue displaying the System Information page instead of terminating with a fatal error.
This change is fully backward compatible and only prevents the fatal error when the function is unavailable.
| Labels |
Added:
No Code Attached Yet
bug
|
||
please test #48130