No Code Attached Yet
avatar RedStar87
RedStar87
15 Mar 2023

Steps to reproduce the issue

Joomla 4.2.8, PHP 8.0 or 8.0 (native)

Expected result

The Joomla System Information (in Information tab) should be displayed (see screenshot under PHP 7.4.3)

Actual result

The page didn't show with a following message:

An error has occurred.

0 Call to undefined function Joomla\Component\Admin\Administrator\Model\phpinfo()

System information (as much as possible)

PHP 8.0, CMS Joomla 4.2.8, SQL 10.5.19-MariaDB-cll-lve, Apache 2.4.55

Additional comments

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

screen shot 2023-03-15 at 18 28 06screen shot 2023-03-15 at 18 28 09screen shot 2023-03-15 at 18 28 12screen shot 2023-03-15 at 18 28 16screen shot 2023-03-15 at 18 28 22

avatar RedStar87 RedStar87 - open - 15 Mar 2023
avatar RedStar87 RedStar87 - change - 15 Mar 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 15 Mar 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Mar 2023
avatar brianteeman
brianteeman - comment - 15 Mar 2023

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(); ?>

avatar RedStar87
RedStar87 - comment - 15 Mar 2023

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.


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

avatar richard67
richard67 - comment - 15 Mar 2023

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.

avatar richard67
richard67 - comment - 15 Mar 2023

P.S.: I would not call that "well configured". Disabling phpinfo is just silly.

avatar RedStar87
RedStar87 - comment - 15 Mar 2023

Hello Richard.

Thank you. Well noted, I will ask again my host and will back here with further information.

Max.


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

avatar brianteeman
brianteeman - comment - 15 Mar 2023

it's a bit weird. I went to add some code to check if phpinfo was disabled etc etc and it is already there and should result in

image

avatar RedStar87
RedStar87 - comment - 15 Mar 2023

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.


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

avatar brianteeman
brianteeman - comment - 15 Mar 2023

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.

avatar RedStar87
RedStar87 - comment - 15 Mar 2023

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.


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

avatar richard67
richard67 - comment - 15 Mar 2023

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

avatar brianteeman
brianteeman - comment - 15 Mar 2023

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

avatar richard67
richard67 - comment - 15 Mar 2023

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?

avatar RedStar87
RedStar87 - comment - 15 Mar 2023

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.


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

avatar brianteeman
brianteeman - comment - 15 Mar 2023

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.

avatar brianteeman
brianteeman - comment - 15 Mar 2023

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

avatar richard67
richard67 - comment - 15 Mar 2023

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

avatar richard67
richard67 - comment - 15 Mar 2023

Matter of taste maybe. Many ways to Rome.

avatar brianteeman
brianteeman - comment - 15 Mar 2023

see #40130

The current code is definitely wrong
The pr is as @richard67 says just one way of skinning the cat

avatar richard67 richard67 - change - 15 Mar 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-03-15 22:29:18
Closed_By richard67
avatar richard67
richard67 - comment - 15 Mar 2023

Closing as having a pull request. Please test #40130 . Thanks in advance.

avatar richard67 richard67 - close - 15 Mar 2023

Add a Comment

Login with GitHub to post a comment