I was getting a warning about not being able to use set_time_limit() in safe mode whenever I called cron.php.

The cron.php script uses the following code to test for safe mode before trying to adjust the time limit:

if (!get_cfg_var("safe_mode")) {
  set_time_limit(240);
}

get_cfg_var() does not always return the correct value for config variables if they are set in the apache config or at compile time.

In my shared hosting system get_cfg_var("safe_mode") returns an empty string even though safe mode is set on in the apache config.

Suggest using ini_get() instead, which does not have the limitation. The following works on my system:
[?
if (!ini_get("safe_mode")) {
set_time_limit(240);
}
?]

Comments

robognome’s picture

I just noticed also that update.php uses get_cfg_var() also.

dries’s picture

Assigned: Unassigned » dries

Thanks robognome. I fixed this in the HEAD branch.

Anonymous’s picture