Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-76509

upgrade from 3.11.11+ to 4.1 shows several "Warning: Creating default object from empty value in /var/www/html/lib/db/upgrade.php on line 2336"

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-76509-400
    • MDL-76509-401
    • MDL-76509-master
    • Hide

      Environment setup

      Stand up an environment using MOODLE_311_STABLE

      Test scenario: 3.11 -> 4.0

      • Login to the site as an admin
      • Create a new course
      • Navigate to course options by clicking the settings cog
      • Select questions
      • Select import tab from the question bank
      • Select Moodle XML format and choose the attached XML file
      • Import the questions
      • Navigate back to the course
      • Create a new quiz
      • Add some random questions to the quiz by selecting some random tags
      • Go to your database console and run the following (This will create all sorts of invalid data in the quiz_slots_tags table):

       -- Correct tag, invalid slot id
      INSERT INTO mdl_quiz_slot_tags
      (slotid, tagid, tagname)
      VALUES
          (24, 3, 'tricky');
       
      INSERT INTO mdl_quiz_slot_tags
      (slotid, tagid, tagname)
      VALUES
          (25, 3, 'tricky');
       
      -- correct slot, invalid tag
      INSERT INTO mdl_quiz_slot_tags
      (slotid, tagid, tagname)
      VALUES
          (1, 57, 'invalidtag');
       
      INSERT INTO mdl_quiz_slot_tags
      (slotid, tagid, tagname)
      VALUES
          (1, 58, 'anotherinvalidtag');
       
      -- both slot and tag invalid
      INSERT INTO mdl_quiz_slot_tags
      (slotid, tagid, tagname)
      VALUES
          (11, 60, 'pureinvalidtag');
       
      INSERT INTO mdl_quiz_slot_tags
      (slotid, tagid, tagname)
      VALUES
          (11, 61, 'anotherpureinvalidtag');

      • Check the quiz_slot_tags table and confirm the data added to the table.
      • Now pull the 4.0 branch from this tracker:

      git fetch https://git.in.moodle.com/moodle/integration.git MOODLE_400_STABLE && git checkout FETCH_HEAD

      • Add the following to your config.php of your moodle instance to ensure any sorts of errors are visible in the console:

      @error_reporting(E_ALL | E_STRICT);
      $CFG->debug = (E_ALL | E_STRICT);

      • Run the following command from the console to run the upgrade:

         php admin/cli/upgrade.php

      • Confirm that there is no such error like the following:

         PHP Warning:  Creating default object from empty value in /var/www/moodle/mdl76509/moodle/lib/db/upgrade.php

         

      • Confirm that the upgrade finishes successfully.

       

      Repeat the whole test with 4.1 and master branches.

       

      Show
      Environment setup Stand up an environment using MOODLE_311_STABLE Test scenario: 3.11 -> 4.0 Login to the site as an admin Create a new course Navigate to course options by clicking the settings cog Select questions Select import tab from the question bank Select Moodle XML format and choose the attached XML file Import the questions Navigate back to the course Create a new quiz Add some random questions to the quiz by selecting some random tags Go to your database console and run the following (This will create all sorts of invalid data in the quiz_slots_tags table): -- Correct tag, invalid slot id INSERT INTO mdl_quiz_slot_tags (slotid, tagid, tagname) VALUES (24, 3, 'tricky');   INSERT INTO mdl_quiz_slot_tags (slotid, tagid, tagname) VALUES (25, 3, 'tricky');   -- correct slot, invalid tag INSERT INTO mdl_quiz_slot_tags (slotid, tagid, tagname) VALUES (1, 57, 'invalidtag');   INSERT INTO mdl_quiz_slot_tags (slotid, tagid, tagname) VALUES (1, 58, 'anotherinvalidtag');   -- both slot and tag invalid INSERT INTO mdl_quiz_slot_tags (slotid, tagid, tagname) VALUES (11, 60, 'pureinvalidtag');   INSERT INTO mdl_quiz_slot_tags (slotid, tagid, tagname) VALUES (11, 61, 'anotherpureinvalidtag'); Check the quiz_slot_tags table and confirm the data added to the table. Now pull the 4.0 branch from this tracker: git fetch https: //git.in.moodle.com/moodle/integration.git MOODLE_400_STABLE && git checkout FETCH_HEAD Add the following to your config.php of your moodle instance to ensure any sorts of errors are visible in the console: @error_reporting(E_ALL | E_STRICT); $CFG->debug = (E_ALL | E_STRICT); Run the following command from the console to run the upgrade: php admin/cli/upgrade.php Confirm that there is no such error like the following: PHP Warning:  Creating default object from empty value in /var/www/moodle/mdl76509/moodle/lib/db/upgrade.php   Confirm that the upgrade finishes successfully.   Repeat the whole test with 4.1 and master branches.  
    • 2
    • Team Hedgehog Sprint 1.2, Team Hedgehog Sprint 1.3
    • Small

    Description

      Hi,

      I was testing upgrading our Moodle code from 3.11.11+ to 4.1 released yesterday.

      I've seen 72 entries (I suppose this 72 is due to our database content) having this exact form, varying some values like $lastslot or the time of the stack.

      Warning: Creating default object from empty value in /var/www/html/lib/db/upgrade.php on line 2336
       
      Call Stack:
          0.0006     426592   1. {main}() /var/www/html/admin/cli/upgrade.php:0
          2.8278   59720488   2. upgrade_core($version = 2022112800, $verbose = TRUE) /var/www/html/admin/cli/upgrade.php:196
          5.6403   61957664   3. xmldb_main_upgrade($oldversion = '2021051710.02') /var/www/html/lib/upgradelib.php:1891
        564.1398   63750216   4. {closure:/var/www/html/lib/db/upgrade.php:2332-2339}($lastslot = '1005824', $tagstrings = [0 => '5779,multirespuesta']) /var/www/html/lib/db/upgrade.php:2346
      

      I'm posting it here, since it is referring to code on upgrading from core. However, the "closure" exposed on the fourth line may refer to third party plugin code.

      These 72 warnings appeared between this upgrade process part:

      ++ 2022020200.04: Èxit (8,97 segons) ++
       
      [################################
      [... here 72 warnings ...]
      ####################++ 2022020200.05: Èxit (303,28 segons) ++
      ++ 2022020200.06: Èxit (17,16 segons) ++
      

      "Èxit" means "Success", and "segons" means "seconds".

      I'll be back if I have something new to say.

      Attachments

        1. 311_to_400.png
          311_to_400.png
          160 kB
        2. 311_to_401.png
          311_to_401.png
          161 kB
        3. 311_to_Master.png
          311_to_Master.png
          157 kB
        4. questions.xml
          24 kB

        Issue Links

          Activity

            People

              safat.shahin@moodle.com Safat Shahin
              jpahullo Jordi Pujol-Ahulló
              Huong Nguyen Huong Nguyen
              Tim Hunt Tim Hunt
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Safat Shahin, Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                16/Jan/23

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 52 minutes
                  4h 52m