Merge pull request #4657 from spekulatius/adding-space-before-casting

adding a space before casting into a different type
This commit is contained in:
Damian Mooyman 2015-10-07 16:00:04 +13:00
commit c724d551a1
5 changed files with 9 additions and 9 deletions

View File

@ -576,7 +576,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
$queryargs = array_merge($queryargs, $localargs);
}
if((is_string($arg) && $arg) || is_numeric($arg)) {
$arg = (string)$arg;
$arg = (string) $arg;
if($result && substr($result,-1) != '/' && $arg[0] != '/') $result .= "/$arg";
else $result .= (substr($result, -1) == '/' && $arg[0] == '/') ? ltrim($arg, '/') : $arg;
}

View File

@ -137,7 +137,7 @@ class Director implements TemplateGlobalProvider {
: $_SERVER['REQUEST_METHOD'],
$url,
$_GET,
ArrayLib::array_merge_recursive((array)$_POST, (array)$_FILES),
ArrayLib::array_merge_recursive((array) $_POST, (array) $_FILES),
@file_get_contents('php://input')
);
@ -310,9 +310,9 @@ class Director implements TemplateGlobalProvider {
}
// Replace the superglobals with appropriate test values
$_REQUEST = ArrayLib::array_merge_recursive((array)$getVars, (array)$postVars);
$_GET = (array)$getVars;
$_POST = (array)$postVars;
$_REQUEST = ArrayLib::array_merge_recursive((array) $getVars, (array) $postVars);
$_GET = (array) $getVars;
$_POST = (array) $postVars;
$_SESSION = $session ? $session->inst_getAll() : array();
$_COOKIE = $cookieJar->getAll(false);
Injector::inst()->registerService($cookieJar, 'Cookie_Backend');

View File

@ -160,7 +160,7 @@ class SS_HTTPResponse {
* @return SS_HTTPRequest $this
*/
public function setBody($body) {
$this->body = $body ? (string)$body : $body; // Don't type-cast false-ish values, eg null is null not ''
$this->body = $body ? (string) $body : $body; // Don't type-cast false-ish values, eg null is null not ''
return $this;
}

View File

@ -87,7 +87,7 @@ class PjaxResponseNegotiator {
foreach($fragments as $fragment) {
if(isset($callbacks[$fragment])) {
$res = call_user_func($callbacks[$fragment]);
$responseParts[$fragment] = $res ? (string)$res : $res;
$responseParts[$fragment] = $res ? (string) $res : $res;
} else {
throw new SS_HTTPResponse_Exception("X-Pjax = '$fragment' not supported for this URL.", 400);
}

View File

@ -351,7 +351,7 @@ class RequestHandler extends ViewableData {
if($action == 'index') return true;
// Don't allow access to any non-public methods (inspect instance plus all extensions)
$insts = array_merge(array($this), (array)$this->getExtensionInstances());
$insts = array_merge(array($this), (array) $this->getExtensionInstances());
foreach($insts as $inst) {
if(!method_exists($inst, $action)) continue;
$r = new ReflectionClass(get_class($inst));
@ -389,7 +389,7 @@ class RequestHandler extends ViewableData {
$action = strtolower($actionOrigCasing);
$definingClass = null;
$insts = array_merge(array($this), (array)$this->getExtensionInstances());
$insts = array_merge(array($this), (array) $this->getExtensionInstances());
foreach($insts as $inst) {
if(!method_exists($inst, $action)) continue;
$r = new ReflectionClass(get_class($inst));