Allow_url_fopen is not enabled!

@OxyDac said:
This is the php code with which Perfex CRM checks if it is enabled

$ url_f_open = ini_get ('allow_url_fopen');
     if ($ url_f_open! = "1" && $ url_f_open! = 'On') {
         $ error = true;
         $ requirement11 = "<span class =" label label-warning "> Allow_url_fopen is not enabled! </ span>";
     } else {
         $ requirement11 = "<span class =" label label-success "> Enabled </ span>";
     }

it is the right way or not - I have no idea

I did some checking, and if this really is the code Perfex uses to check if allow_url_fopen is enabled, then Perfex clearly messed up here. That code to check whether the setting is enabled is plainly wrong.

The script checks is the setting allow_url_fopen is set to 1 or On, which are both valid ways to enable an option in PHP. However, in our server, the setting is set to on (fully lower case). The script checks whether the setting is equal to On rather than on, so it incorrectly believes that the setting is not on.

Options in PHP which can be turned of can be turned on with 1, on, true and yes, (and any capitalization) and turned off with 0, off, false and no (again, all capitalization are valid). Additionally, an empty setting should be considered equal to off and any other string or number should be considered on.

This is how PHP itself parses it’s config file:

String values “true”, “on” and “yes” are converted to TRUE. “false”, “off”, “no” and “none” are considered FALSE. “null” is converted to NULL in typed mode. Also, all numeric strings are converted to integer type if it is possible.

Send this to Perfex with the message that they should fix their code.

2 Likes