Moodle: Notice: Only variable references should be returned by reference

PHP Scripts | Updated 2026

The "Notice: Only variable references should be returned by reference" error in Moodle is the same PHP compatibility issue that affects several older PHP applications. The code uses a syntax pattern that modern PHP versions flag as incorrect.

01. Update Moodle

The proper fix is to update Moodle. Before updating:

  1. Back up your database and files - See How to Back Up Your Website
  2. Check Moodle's system requirements for the version you are upgrading to (PHP version, database version, etc.)
  3. Update PHP if needed - See How to Change Your PHP Version
  4. Follow Moodle's upgrade documentation at moodle.org

02. Temporary Fix: Suppress Notices

PHP notices are informational messages, not errors. Your Moodle installation still functions with these notices appearing. To hide them, create a .user.ini file in your Moodle directory:

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

Or use cPanel > Software > MultiPHP INI Editor to change the error reporting level for your domain.

Important

Moodle is a complex application used for education. Running an outdated version poses security risks for both you and your users' data. If you manage student information, updating is especially important for data protection compliance.

Need Help With Moodle?

If you need assistance updating Moodle or resolving PHP errors, open a support ticket.

Open a Support Ticket

Quick Recap

  1. This is a PHP compatibility notice, not a fatal error
  2. Update Moodle for the proper fix
  3. Suppress notices temporarily via .user.ini if you cannot update yet
  4. Back up everything before updating
  5. Check PHP version requirements for the new Moodle version

PHP script compatibility · Last updated March 2026 · Browse all PHP Scripts articles

  • 509 Users Found This Useful

Was this answer helpful?

Related Articles

Joomla Warning: Parameter 2 to frontpage()

Obsolete | 2026 This Article Is Outdated This error affected Joomla 1.5 and 2.5, both of...

Best WP Plugins

WordPress | Updated March 2026 Here are the most recommended WordPress plugins across the...

How do I reset Zen Cart administrator password?

PHP Scripts | Updated 2026 If you are locked out of your Zen Cart admin panel, you can reset...

PHPList Email Throttling

PHP Scripts | Updated 2026 PHPList is an open-source email newsletter manager. If your...



Save 30% on web hosting - Use coupon code Hosting30