dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add CollationFa"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiFormatPhp.php
diff --git
a/includes/api/ApiFormatPhp.php
b/includes/api/ApiFormatPhp.php
index
f5f2504
..
a744f57
100644
(file)
--- a/
includes/api/ApiFormatPhp.php
+++ b/
includes/api/ApiFormatPhp.php
@@
-39,23
+39,24
@@
class ApiFormatPhp extends ApiFormatBase {
switch ( $params['formatversion'] ) {
case 1:
switch ( $params['formatversion'] ) {
case 1:
- $transforms =
array(
- 'BC' =>
array()
,
- 'Types' =>
array()
,
+ $transforms =
[
+ 'BC' =>
[]
,
+ 'Types' =>
[]
,
'Strip' => 'all',
'Strip' => 'all',
-
)
;
+
]
;
break;
case 2:
case 'latest':
break;
case 2:
case 'latest':
- $transforms =
array(
- 'Types' =>
array()
,
+ $transforms =
[
+ 'Types' =>
[]
,
'Strip' => 'all',
'Strip' => 'all',
-
)
;
+
]
;
break;
default:
break;
default:
- $this->dieUsage( __METHOD__ . ': Unknown value for \'formatversion\'', 'unknownformatversion' );
+ // Should have been caught during parameter validation
+ $this->dieDebug( __METHOD__, 'Unknown value for \'formatversion\'' );
}
$text = serialize( $this->getResult()->getResultData( null, $transforms ) );
}
$text = serialize( $this->getResult()->getResultData( null, $transforms ) );
@@
-65,26
+66,22
@@
class ApiFormatPhp extends ApiFormatBase {
// just be broken in a useful manner.
if ( $this->getConfig()->get( 'MangleFlashPolicy' ) &&
in_array( 'wfOutputHandler', ob_list_handlers(), true ) &&
// 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 )
+ preg_match( '/\<\s*cross-domain-policy
(?=\s|\>)
/i', $text )
) {
) {
- $this->dieUsage(
- 'This response cannot be represented using format=php. ' .
- 'See https://phabricator.wikimedia.org/T68776',
- 'internalerror'
- );
+ $this->dieWithError( 'apierror-formatphp', 'internalerror' );
}
$this->printText( $text );
}
public function getAllowedParams() {
}
$this->printText( $text );
}
public function getAllowedParams() {
- $ret = parent::getAllowedParams() +
array(
- 'formatversion' =>
array(
- ApiBase::PARAM_TYPE =>
array( 1, 2, 'latest' )
,
+ $ret = parent::getAllowedParams() +
[
+ 'formatversion' =>
[
+ ApiBase::PARAM_TYPE =>
[ 1, 2, 'latest' ]
,
ApiBase::PARAM_DFLT => 1,
ApiBase::PARAM_HELP_MSG => 'apihelp-php-param-formatversion',
ApiBase::PARAM_DFLT => 1,
ApiBase::PARAM_HELP_MSG => 'apihelp-php-param-formatversion',
-
)
,
-
)
;
+
]
,
+
]
;
return $ret;
}
}
return $ret;
}
}