Public bug reported:

When we set $cfg->urlsecret on config.php, cron.php doesn't work on
cronjob under PHP FastCGI environment.

So we need to add one more condition to cron.php as below.

File to modify:
lib/cron.php

Line:
40

[before]
if (php_sapi_name() != 'cli' && get_config('urlsecret') !== null) {
    $urlsecret = param_alphanumext('urlsecret', -1);
    if ($urlsecret !== get_config('urlsecret')) {
        die_info(get_string('accessdeniednourlsecret', 'error'));
    }
}

[after]
if (php_sapi_name() != 'cli' && substr(php_sapi_name(), 0, 3) !== 'cgi' && 
get_config('urlsecret') !== null) {
    $urlsecret = param_alphanumext('urlsecret', -1);
    if ($urlsecret !== get_config('urlsecret')) {
        die_info(get_string('accessdeniednourlsecret', 'error'));
    }
}

Ref:
[PHP: php_sapi_name - Manual]
https://www.php.net/manual/en/function.php-sapi-name.php

** Affects: mahara
     Importance: High
         Status: New

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1851699

Title:
  cron.php with '$cfg->urlsecret' dosen't work on cronjob under PHP
  FastCGI enviroment.

Status in Mahara:
  New

Bug description:
  When we set $cfg->urlsecret on config.php, cron.php doesn't work on
  cronjob under PHP FastCGI environment.

  So we need to add one more condition to cron.php as below.

  File to modify:
  lib/cron.php

  Line:
  40

  [before]
  if (php_sapi_name() != 'cli' && get_config('urlsecret') !== null) {
      $urlsecret = param_alphanumext('urlsecret', -1);
      if ($urlsecret !== get_config('urlsecret')) {
          die_info(get_string('accessdeniednourlsecret', 'error'));
      }
  }

  [after]
  if (php_sapi_name() != 'cli' && substr(php_sapi_name(), 0, 3) !== 'cgi' && 
get_config('urlsecret') !== null) {
      $urlsecret = param_alphanumext('urlsecret', -1);
      if ($urlsecret !== get_config('urlsecret')) {
          die_info(get_string('accessdeniednourlsecret', 'error'));
      }
  }

  Ref:
  [PHP: php_sapi_name - Manual]
  https://www.php.net/manual/en/function.php-sapi-name.php

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1851699/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : mahara-contributors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to