Skip to content

Commit

Permalink
MDL-56110 forms: debug message for php 7.1 compat
Browse files Browse the repository at this point in the history
Follow up for MDL-55123
  • Loading branch information
marinaglancy committed Oct 13, 2016
1 parent d9520bc commit 62a3c42
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/pear/HTML/QuickForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,16 @@ function getMaxFileSize()
*/
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;
Expand Down

0 comments on commit 62a3c42

Please sign in to comment.