From 62a3c42947e0e0184554cbe459a967a4c41e0224 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Sun, 25 Sep 2016 13:20:53 +0800 Subject: [PATCH] MDL-56110 forms: debug message for php 7.1 compat Follow up for MDL-55123 --- lib/pear/HTML/QuickForm.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/pear/HTML/QuickForm.php b/lib/pear/HTML/QuickForm.php index 711e956f9f7..d74dd55ef43 100644 --- a/lib/pear/HTML/QuickForm.php +++ b/lib/pear/HTML/QuickForm.php @@ -544,6 +544,16 @@ class HTML_QuickForm extends HTML_Common { */ function &createElement($elementType) { + if (!isset($this) || !($this instanceof HTML_QuickForm)) { + // Several form elements in Moodle core before 3.2 were calling this method + // statically suppressing PHP notices. This debugging message should notify + // developers who copied such code and did not test their plugins on PHP 7.1. + // Example of fixing group form elements can be found in commit + // https://github.com/moodle/moodle/commit/721e2def56a48fab4f8d3ec7847af5cd03f5ec79 + debugging('Function createElement() can not be called statically, ' . + 'this will no longer work in PHP 7.1', + DEBUG_DEVELOPER); + } $args = func_get_args(); $element = self::_loadElement('createElement', $elementType, array_slice($args, 1)); return $element; -- 2.11.4.GIT