Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-29862 incorrect wwwroot must be detected before session start

  • Loading branch information...
commit 06f72d26d72156052f58b760ce7b6f27cf9b8d9d 1 parent e04dba0
Petr Škoda authored October 21, 2011
7  lib/setup.php
@@ -663,6 +663,9 @@ function stripslashes_deep($value) {
663 663
     unset($phppos);
664 664
 }
665 665
 
  666
+// initialise ME's - this must be done BEFORE starting of session!
  667
+initialise_fullme();
  668
+
666 669
 // init session prevention flag - this is defined on pages that do not want session
667 670
 if (CLI_SCRIPT) {
668 671
     // no sessions in CLI scripts possible
@@ -685,10 +688,6 @@ function stripslashes_deep($value) {
685 688
 $SESSION = &$_SESSION['SESSION'];
686 689
 $USER    = &$_SESSION['USER'];
687 690
 
688  
-// initialise ME's
689  
-// This must presently come AFTER $USER has been set up.
690  
-initialise_fullme();
691  
-
692 691
 // Late profiling, only happening if early one wasn't started
693 692
 if (!empty($CFG->profilingenabled)) {
694 693
     require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
7  lib/setuplib.php
@@ -661,7 +661,7 @@ function initialise_cfg() {
661 661
  * setup.php.
662 662
  */
663 663
 function initialise_fullme() {
664  
-    global $CFG, $FULLME, $ME, $SCRIPT, $FULLSCRIPT;
  664
+    global $CFG, $FULLME, $ME, $SCRIPT, $FULLSCRIPT, $USER;
665 665
 
666 666
     // Detect common config error.
667 667
     if (substr($CFG->wwwroot, -1) == '/') {
@@ -715,6 +715,11 @@ function initialise_fullme() {
715 715
             if (!defined('NO_MOODLE_COOKIES')) {
716 716
                 define('NO_MOODLE_COOKIES', true);
717 717
             }
  718
+            if (!isset($USER->id)) {
  719
+                // MDL-27899 workaround
  720
+                $USER = new stdClass();
  721
+                $USER->id = 0;
  722
+            }
718 723
             redirect($CFG->wwwroot, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 3);
719 724
         }
720 725
     }

0 notes on commit 06f72d2

Please sign in to comment.
Something went wrong with that request. Please try again.