X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatPhp.php;h=a4b4a11d61725f7fed141f95c12d56190d564402;hb=13142cd2f4684ffa6c51e5b9d14692988a408d0b;hp=99a047a55bc96aa345ac7e7f0b7962c827d4efbc;hpb=eeaca0a97fcb416c0ae2b24aec0b8ab76c30cac6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatPhp.php b/includes/api/ApiFormatPhp.php index 99a047a55b..a4b4a11d61 100644 --- a/includes/api/ApiFormatPhp.php +++ b/includes/api/ApiFormatPhp.php @@ -30,19 +30,27 @@ */ class ApiFormatPhp extends ApiFormatBase { - public function __construct( $main, $format ) { - parent::__construct( $main, $format ); - } - public function getMimeType() { return 'application/vnd.php.serialized'; } public function execute() { - $this->printText( serialize( $this->getResultData() ) ); - } + $text = serialize( $this->getResultData() ); + + // Bug 66776: wfMangleFlashPolicy() is needed to avoid a nasty bug in + // Flash, but what it does isn't friendly for the API. There's nothing + // we can do here that isn't actively broken in some manner, so let's + // just be broken in a useful manner. + if ( $this->getConfig()->get( 'MangleFlashPolicy' ) && + in_array( 'wfOutputHandler', ob_list_handlers(), true ) && + preg_match( '/\<\s*cross-domain-policy\s*\>/i', $text ) + ) { + $this->dieUsage( + 'This response cannot be represented using format=php. See https://bugzilla.wikimedia.org/show_bug.cgi?id=66776', + 'internalerror' + ); + } - public function getDescription() { - return 'Output data in serialized PHP format' . parent::getDescription(); + $this->printText( $text ); } }