https://bugzilla.wikimedia.org/show_bug.cgi?id=54084
Web browser: ---
Bug ID: 54084
Summary: Fatal error: Call to undefined function gzdecode()
Product: MediaWiki extensions
Version: master
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Unprioritized
Component: TemplateData
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
steps to reproduce
==================
1. create a test template, Template:Test in a wiki using PHP < 5.4.0 and with
the TemplateData extension active.
2. place a test <templatedata/> JSON in the template
3. use the api to retrieve the templatedata as a JSON with
api.php?action=templatedata&titles=Template:Test
result
======
Fatal error: Call to undefined function gzdecode() in
/core/extensions/TemplateData/TemplateDataBlob.php on line 59
expected result
===============
the JSON in Template:Test.
issue
=====
TemplateData/TemplateDataBlob.php line 59 relies on gzdecode() to decode a
potentially gzipped JSON. gzdecode() is only available in (PHP 5 >= 5.4.0) when
compiled with zlib.
potential solution
==================
public static function newFromDatabase( $json ) {
// Handle GZIP compression. \037\213 is the header for GZIP files.
if ( substr( $json, 0, 2 ) === "\037\213" ) {
if ( function_exists( 'gzdecode' ) ) {
$json = gzdecode( $json );
} else {
$json = gzinflate( substr( $json, 10, -8 ) );
}
}
return self::newFromJSON( $json );
}
@see
http://stackoverflow.com/questions/9801908/php-call-to-undefined-function-gzdecode#answer-10381158.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l