Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by William Stewart -
Number of replies: 16

Moodle 3.1.2+ | php 7 

I successfully was able to upgrade the 3.2 beta to the 3.2 release today.  I was able to do a fresh install of 3.2 as well.

I tried to upgrade a 3.1.2+ installation (a copy of our production site) in several ways, but to no avail. To save some time (yes, yes, being lazy in my mamp installation), I simply copied the new 3.2 code on top of the 3.1.2+ directory. Moodle gave me an message saying it detected two different php codes in the moodle directory (as a result of copying over the new onto the old no less- it knew exactly what I was doing!).

I took a fresh 3.2 directory and moved the plugins over and ended up with the following error:

"Exception - Call to a member function setup() on null"

I tried using just the 3.2 directory without the plugins (assuming I would get a list of items missing from disk) and still ended up with "Exception - Call to a member function setup() on null" when I moved the config.php over.

I gave up on trying to upgrade 3.1.2+ to 3.2 and instead upgraded it 3.1.3+ and had no issues.

Not sure what my next steps are- any advice would be appreciated. Just want to do some testing over the next month.

Average of ratings: -
In reply to William Stewart

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Derek Chaplin -

I got the same error message "Exception - Call to a member function setup() on null" trying to update a Moodle 3.12 install to 3.2. So I updated to 3.13 and tried again - same result.

I followed the proper procedure; backed up the Moodle folder, deleted the original folder contents, copied the new 3.2 folders over and then copied the config.php from th backup to the original folder.

Fortunately I was able to restore the original system by deleteing all the new 3.2 files and copying the backup files/folders back to the original folder.

Running on a Virtual Hosted Server running PHP 7.0.

In reply to William Stewart

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Use the config file to turn full debugging on and try again.  Then report back with the full error and the exact point at which it occurs.

(You might try deleting cache and localcache folders from moodledata too - they are sometimes culprits of all kinds of errors.)

In reply to William Stewart

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Ken Task -
Picture of Particularly helpful Moodlers

@ all .... what specific version of PHP?   7.0.6 had a problem like that (seen via Google Search) affecting some apps ... like Joomla and others.   Upgrade to 7.0.7 (something higher) fixed in some apps.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Mathieu Pelletier -

Hello All, 

I am also getting this error, when upgrading from 3.0.4+.  I was able to upgrade successfully during the release candidates, but something has changed in today's stable release (pulled from moodle on github) that is causing the upgrade to fail.  The release candidate did state that php 5.6 or higher was required and this is what I have.  Here is the full output from upgrade.php (command line):

Are you sure you want to upgrade this server to this version?


type y (means yes) or n (means no)

: y

PHP Fatal error:  Call to a member function setup() on null in /var/www/moodle32/lib/filterlib.php on line 299

PHP Stack trace:

PHP   1. {main}() /var/www/moodle32/admin/cli/upgrade.php:0

PHP   2. upgrade_core() /var/www/moodle32/admin/cli/upgrade.php:175

PHP   3. print_upgrade_part_start() /var/www/moodle32/lib/upgradelib.php:1677

PHP   4. bootstrap_renderer->heading() /var/www/moodle32/lib/upgradelib.php:1490

PHP   5. bootstrap_renderer->__call() /var/www/moodle32/lib/upgradelib.php:1490

PHP   6. moodle_page->initialise_theme_and_output() /var/www/moodle32/lib/setuplib.php:1826

PHP   7. filter_manager->setup_page_for_globally_available_filters() /var/www/moodle32/lib/pagelib.php:1604


Thanks in advance for any help you can offer!

P.S. deleting the caches in moodledata did nothing for me.  YMMV!

In reply to Mathieu Pelletier

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Mathieu Pelletier -

Okay, so whatever the problem is seems to have been introduced in Moodle v3.2.0-rc5, since rc4 upgrades without issue using the same database and server.

In reply to Mathieu Pelletier

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

So this now looks like a theme issue - I would suggest entering a Tracker item.

In reply to Emma Richardson

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Stefan Roder -

Hello everybody

Unfortunately I can confirm this behavior. Coming from Moodle 3.1.1 and willing to upgrade to 3.2

Shared host on Strato

Error message says: Exception - Call to a member function setup() on null

Using Adaptable Theme, latest version from today  1.2.5rc2 (2016120500)

Best regards and keep on with this incredible work,

Stefan


P.S.:

This is the detailed error message after turning on debugging:


Debug info: 
Error code: generalexceptionmessage
Stack trace:
  • line 299 of /lib/filterlib.php: Error thrown
  • line 1604 of /lib/pagelib.php: call to filter_manager->setup_page_for_globally_available_filters()
  • line 674 of /lib/pagelib.php: call to moodle_page->initialise_theme_and_output()
  • line 861 of /lib/pagelib.php: call to moodle_page->magic_get_theme()
  • line 337 of /admin/index.php: call to moodle_page->get_renderer()
Fehler: Call to a member function setup() on null
Debug info: 
Error code: generalexceptionmessage
Stack trace:
  • line 299 of /lib/filterlib.php: Error thrown
  • line 1604 of /lib/pagelib.php: call to filter_manager->setup_page_for_globally_available_filters()
  • line 659 of /lib/blocklib.php: call to moodle_page->initialise_theme_and_output()
  • line 1527 of /lib/pagelib.php: call to block_manager->load_blocks()
  • line 960 of /lib/pagelib.php: call to moodle_page->starting_output()
  • line 1035 of /lib/outputrenderers.php: call to moodle_page->set_state()
  • line 2771 of /lib/outputrenderers.php: call to core_renderer->header()
  • line 388 of /lib/setuplib.php: call to core_renderer->fatal_error()
  • line ? of unknownfile: call to default_exception_handler()
Update as suggested below:
Clearing all cache folder has no effect!
In reply to Stefan Roder

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by William Stewart -
Thanks for posting this information. I posted the original shortly before going to bed and am relieved to know that it isn't just me! How do we submit a tracker for this?
In reply to Stefan Roder

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Stefan Roder -

Just wanna announce that the problem is fixed with the latest release 3.2+

Everything works fine for me know and installation process ran through without problems!

Who ever fixed that - Thanks for the quick and proper work smile

In reply to Stefan Roder

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by William Stewart -

Also fine for me as well. Upgraded my MAMP installation the other night as well. Switched over to php 70 last night on the production site, and otherwise just testing and checking out bug fixes until we upgrade towards the end of December. We have our own custom theme but as usual the other improvements are greatly appreciated!

In reply to Emma Richardson

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Josiah Carberry -

I can confirm that this upgrade works OK when using the clean theme, but when using the decaf theme, it fails with this error, which appears after clicking on OK after the plugins are upgraded:


Click on Continue

The following error messages displayed:

Notice: Undefined index: mycourses in /blahblah/moodle/lib/navigationlib.php on line

2522
Exception - Call to a member function find() on null
Debug info:
Error code: generalexceptionmessage
Stack trace:

    line 2522 of /lib/navigationlib.php: Error thrown
    line 683 of /theme/decaf/lib.php: call to global_navigation->add_course()
    line 337 of /theme/decaf/lib.php: call to theme_decaf_expand_navigation->add_course()
    line 319 of /theme/decaf/lib.php: call to theme_decaf_expand_navigation->initialise()
    line 88 of /theme/decaf/classes/topsettings_renderer.php: call to theme_decaf_expand_navigation->__construct()
    line 21 of /theme/decaf/classes/topsettings_renderer.php: call to theme_decaf_topsettings_renderer->navigation_node()
    line 49 of /theme/decaf/lib.php: call to theme_decaf_topsettings_renderer->navigation_tree()
    line 18 of /theme/decaf/layout/columns1.php: call to theme_decaf_init()
    line 1110 of /lib/outputrenderers.php: call to include()
    line 1040 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
    line 1827 of /lib/setuplib.php: call to core_renderer->header()
    line 342 of /login/index.php: call to bootstrap_renderer->__call()

In reply to Mathieu Pelletier

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Shamim Rezaie -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers Picture of Translators

Do you have any custom filter plugin in you Moodle? If so, you need to place the plugin code inside the filter directory before upgrade.

In reply to William Stewart

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by Marina Glancy -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Thanks for the report,

I have created MDL-57283, we will fix it ASAP

Average of ratings: Useful (1)
In reply to Marina Glancy

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by William Stewart -

Brilliant, thanks Marina smile.

In reply to Marina Glancy

Re: Moodle 3.1.2+ to 3.2 (In MAMP) upgrade error-Exception - Call to a member function setup() on null

by John Doyle -
Thanks for the quick fix!