From 9708ff95fdbaf416104db29946cc7256e092c9b1 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Thu, 10 Dec 2015 14:25:20 +0000 Subject: [PATCH] MDL-52471 setuplib: depreciate class object properly Previously was marked depricated but not throwwing debugging --- lib/setuplib.php | 9 ++++++++- lib/tests/setuplib_test.php | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/setuplib.php b/lib/setuplib.php index 145c4a47fa1..85ab176d54d 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -63,7 +63,14 @@ define('MEMORY_HUGE', -4); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @deprecated since 2.0 */ -class object extends stdClass {}; +class object extends stdClass { + /** + * Constructor. + */ + public function __construct() { + debugging("'object' class has been deprecated, please use stdClass instead.", DEBUG_DEVELOPER); + } +}; /** * Base Moodle Exception class diff --git a/lib/tests/setuplib_test.php b/lib/tests/setuplib_test.php index b46cd645092..787e581adb8 100644 --- a/lib/tests/setuplib_test.php +++ b/lib/tests/setuplib_test.php @@ -460,4 +460,10 @@ class core_setuplib_testcase extends advanced_testcase { return get_exception_info($e); } } + + public function test_object() { + $obj = new object(); + $this->assertDebuggingCalled("'object' class has been deprecated, please use stdClass instead."); + $this->assertInstanceOf('stdClass', $obj); + } }