Joomla 4.2.8, PHP 8.0 or 8.0 (native)
The Joomla System Information (in Information tab) should be displayed (see screenshot under PHP 7.4.3)
The page didn't show with a following message:
An error has occurred.
0 Call to undefined function Joomla\Component\Admin\Administrator\Model\phpinfo()
PHP 8.0, CMS Joomla 4.2.8, SQL 10.5.19-MariaDB-cll-lve, Apache 2.4.55
See screenshots with PHP 8 Error and current PHP settings. PHP 7.4.3 and proper functioning also attached in screenshots.
Thank you in advance.
Max
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Hi Brian.
Thanks for you response. I tried and has the following:
Fatal error: Uncaught Error: Call to undefined function phpinfo() in /home/mysite.net/test.php:1 Stack trace: #0 {main} thrown in /home/mysite.net/test.php on line 1.
My webhost confirmed that the php.ini is well configured: disable_functions = "show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open"
Does it mean that the phpinfo is missing?
Max.
My webhost confirmed that the php.ini is well configured: disable_functions = "show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open"
Does it mean that the phpinfo is missing?
@RedStar87 It means that the phpinfo function is disabled by the disable_functions
setting.
P.S.: I would not call that "well configured". Disabling phpinfo is just silly.
Hello Richard.
Thank you. Well noted, I will ask again my host and will back here with further information.
Max.
Brian, Richard,
My host gave me a feedback saying that the phpinfo is not supplied (activated) on this server. At the same time he's right affirmating that this function has no impact on the issue as it has never been activated under PHP 8 nor under the PHP 7...
So there's some other stuff that makes the J4 system information unavailable.
Max.
Sorry but your host is wrong as the page you are trying to go to accesses the phpinfo function and as it can't then it gives the error.
I have been doing some extensive testing and I have found that the code we have to check if phpinfo is disabled can be improved as it only works (produces the screenshot I posted above) if phpinfo is the first of the disabled functions.
I am exploring alternative tests now.
Hi Brian. Yes I understand. But the reality is here: when I'm switching back to PHP 7.4.33 all tabs of the system info. in Joomla displays perfectly, once turning back on PHP 8.0 there's an error, independently of the phpinfo settings...
Max.
I have been doing some extensive testing and I have found that the code we have to check if phpinfo is disabled can be improved as it only works (produces the screenshot I posted above) if phpinfo is the first of the disabled functions.
@brianteeman Hmm, the code here uses in_array so it should not depend on the position in the array: https://github.com/joomla/joomla-cms/blob/4.2-dev/administrator/components/com_admin/src/Model/SysinfoModel.php#L339
I found the problem
If the line in php ini looks like this then our code correctly determines that phpinfo is not enabled
disable_functions = system,shell_exec,passthru,exec,phpinfo,popen,proc_open
However if the line contains spacesb then it fails
disable_functions = system, shell_exec, passthru, exec, phpinfo, popen, proc_open
@richard67 yes I was mistaken in that. You can see why from the information above why it worked when it was in the first place only when the string contained spaces
Yes, I see. Maybe we should do an str_replace to remove the spaces from the result of ini_get before exploding it to an array?
Yes, exactly. My host uses spaces, like the example that he provided to me:
disable_functions = "show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open"
Max.
That is the problem.
The disable_functions directive is a comma-separated list of functions that are disabled on the server. If you include a space after the comma, then the PHP interpreter will interpret it as a different function name that includes the space character, and that function name would not exist.
Yes, I see. Maybe we should do an str_replace to remove the spaces from the result of ini_get before exploding it to an array?
that would be a sensible approach
Yes, I see. Maybe we should do an str_replace to remove the spaces from the result of ini_get before exploding it to an array?
that would be a sensible approach
Or we use array_map with the trim method, or we use preg_split instead of explode. Find examples for both here: https://stackoverflow.com/questions/35262420/explode-comma-separated-values-with-or-without-spaces
Matter of taste maybe. Many ways to Rome.
see #40130
The current code is definitely wrong
The pr is as @richard67 says just one way of skinning the cat
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-03-15 22:29:18 |
Closed_By | ⇒ | richard67 |
Can you run phpinfo outside of joomla? I have seen some crazy hosts disable it.
Create a file called test.php in the root of your webspace with the following content and see if it loads when you open that url in your browser
<?php phpinfo(); ?>