*/
class WebRequest {
protected $data, $headers = array();
- private $_response;
+
+ /**
+ * Lazy-init response object
+ * @var WebResponse
+ */
+ private $response;
public function __construct() {
/// @todo Fixme: this preemptive de-quoting can interfere with other web libraries
public function interpolateTitle() {
global $wgUsePathInfo;
+ // bug 16019: title interpolation on API queries is useless and sometimes harmful
+ if ( defined( 'MW_API' ) ) {
+ return;
+ }
+
if ( $wgUsePathInfo ) {
// PATH_INFO is mangled due to http://bugs.php.net/bug.php?id=31892
// And also by Apache 2.x, double slashes are converted to single slashes.
/**
* Return a handle to WebResponse style object, for setting cookies,
* headers and other stuff, for Request being worked on.
+ *
+ * @return WebResponse
*/
public function response() {
/* Lazy initialization of response object for this request */
- if ( !is_object( $this->_response ) ) {
+ if ( !is_object( $this->response ) ) {
$class = ( $this instanceof FauxRequest ) ? 'FauxResponse' : 'WebResponse';
- $this->_response = new $class();
+ $this->response = new $class();
}
- return $this->_response;
+ return $this->response;
}
/**