From dc1e092e692480082126d0218b52843d31540537 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 26 Jan 2018 10:16:13 -0800 Subject: [PATCH] skins: Deprecate QuickTemplate::setRef() Removed all use from core. It was only used in a handful of other repos, most of which have been updated already. Bug: T140664 Change-Id: I6b1ea3221022597ca38a5cd40eee040d34d1abb8 --- RELEASE-NOTES-1.31 | 4 ++++ includes/skins/QuickTemplate.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 264113e18a..f4e81b9363 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -190,6 +190,10 @@ changes to languages because of Phabricator reports. * PreparedEdit->newText * PreparedEdit->oldText * PreparedEdit->pst +* QuickTemplate::setRef() was deprecated in favour of QuickTemplate::set(). + Setting template variables by reference allowed violating the principle of data being + immutable once added to the skin template. In practice, this method was not being + used for that. Rather, setRef() existed as memory optimisation for PHP 4. == Compatibility == MediaWiki 1.31 requires PHP 5.5.9 or later. Although HHVM 3.18.5 or later is supported, diff --git a/includes/skins/QuickTemplate.php b/includes/skins/QuickTemplate.php index d1be4bb0df..19b41ba969 100644 --- a/includes/skins/QuickTemplate.php +++ b/includes/skins/QuickTemplate.php @@ -91,10 +91,14 @@ abstract class QuickTemplate { } /** + * @deprecated since 1.31 This function is a now-redundant optimisation intended + * for very old versions of PHP. The use of references here makes the code + * more fragile and is incompatible with plans like T140664. Use set() instead. * @param string $name * @param mixed &$value */ public function setRef( $name, &$value ) { + wfDeprecated( __METHOD__, '1.31' ); $this->data[$name] =& $value; } -- 2.20.1