Hashar has uploaded a new change for review.

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


Change subject: test gzdecode() in TemplateDataBlob::newFromDatabase()
......................................................................

test gzdecode() in TemplateDataBlob::newFromDatabase()

gzdecode() has been introduced in PHP 5.4 although gzencode() has been
there for a while.  Wikimedia is still using PHP 5.3, so the
TemplateDataBlob::newFromDatabase() would trigger a fatal error whenever
it is passed compressed json :-(

The test does not fix the root cause (that needs a fallback function in
MediaWiki core), but it does highlight the issue in PHP 5.3.x.

bug: 54058
Change-Id: I8357b474165f4317982b9c924cf0afe68650d677
---
M tests/TemplateDataBlobTest.php
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/82/83982/1

diff --git a/tests/TemplateDataBlobTest.php b/tests/TemplateDataBlobTest.php
index 712d84a..105320d 100644
--- a/tests/TemplateDataBlobTest.php
+++ b/tests/TemplateDataBlobTest.php
@@ -381,4 +381,19 @@
                        $cases['msg']
                );
        }
+
+       /**
+        * Verify we can gzdecode() which came in PHP 5.4.0. Mediawiki needs a
+        * fallback function for it.
+        * If this test fail, we are most probably attempting to use gzdecode()
+        * with PHP before 5.4.
+        *
+        * @see bug 54058
+        */
+       public function testGetJsonForDatabase() {
+               // Compress JSON to trigger the code pass in newFromDatabase 
that ends
+               // up calling gzdecode().
+               $gzJson = gzencode( '{}' );
+               TemplateDataBlob::newFromDatabase( $gzJson );
+       }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8357b474165f4317982b9c924cf0afe68650d677
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TemplateData
Gerrit-Branch: master
Gerrit-Owner: Hashar <has...@free.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to