Wctaiwan has uploaded a new change for review.
https://gerrit.wikimedia.org/r/155292
Change subject: Set and get object copies in MapCacheLRU
......................................................................
Set and get object copies in MapCacheLRU
Instead of object references, which seems to be the current behaviour.
As far as I can see, only the Title class uses MapCacheLRU in core; not
sure if this would break extensions.
Bug: 69788
Bug: 69789
Change-Id: I49ad5b3d46921a576cfb86c3c8bc415297ca996e
---
M includes/cache/MapCacheLRU.php
1 file changed, 10 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/92/155292/1
diff --git a/includes/cache/MapCacheLRU.php b/includes/cache/MapCacheLRU.php
index a22d802..563b9d1 100644
--- a/includes/cache/MapCacheLRU.php
+++ b/includes/cache/MapCacheLRU.php
@@ -64,7 +64,11 @@
$evictKey = key( $this->cache );
unset( $this->cache[$evictKey] );
}
- $this->cache[$key] = $value;
+ if ( is_object( $value ) ) {
+ $this->cache[$key] = clone $value;
+ } else {
+ $this->cache[$key] = $value;
+ }
}
/**
@@ -88,7 +92,11 @@
public function get( $key ) {
if ( isset( $this->cache[$key] ) ) {
$this->ping( $key ); // push to top
- return $this->cache[$key];
+ if ( is_object( $this->cache[$key] ) ) {
+ return clone $this->cache[$key];
+ } else {
+ return $this->cache[$key];
+ }
} else {
return null;
}
--
To view, visit https://gerrit.wikimedia.org/r/155292
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I49ad5b3d46921a576cfb86c3c8bc415297ca996e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Wctaiwan <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits