Parent5446 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64277


Change subject: Fix return type of MessageCache::getMsgFromNamespace for 
existing
......................................................................

Fix return type of MessageCache::getMsgFromNamespace for existing

Functions expect the message cache to return a string if a message
exists, even empty, and false if it does not exist. This adds casting
to the substr() function, which would return false for existing
messages that were just blank.

Bug: 14176
Change-Id: Id91914a3701fe53f1e2e894824512489392c628b
---
M includes/cache/MessageCache.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/77/64277/1

diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php
index 49db857..60769f5 100644
--- a/includes/cache/MessageCache.php
+++ b/includes/cache/MessageCache.php
@@ -755,7 +755,7 @@
                if ( isset( $this->mCache[$code][$title] ) ) {
                        $entry = $this->mCache[$code][$title];
                        if ( substr( $entry, 0, 1 ) === ' ' ) {
-                               return substr( $entry, 1 );
+                               return (string)substr( $entry, 1 );
                        } elseif ( $entry === '!NONEXISTENT' ) {
                                return false;
                        } elseif ( $entry === '!TOO BIG' ) {
@@ -778,7 +778,7 @@
                if ( $entry ) {
                        if ( substr( $entry, 0, 1 ) === ' ' ) {
                                $this->mCache[$code][$title] = $entry;
-                               return substr( $entry, 1 );
+                               return (string)substr( $entry, 1 );
                        } elseif ( $entry === '!NONEXISTENT' ) {
                                $this->mCache[$code][$title] = '!NONEXISTENT';
                                return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/64277
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id91914a3701fe53f1e2e894824512489392c628b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Parent5446 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to