From 773666ddad93d3eb713b3c1f521a29e0d1a12a32 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 17 Jan 2013 20:34:25 -0500 Subject: [PATCH] Fix coding standards and save a function call. --- lib/Cake/Network/CakeRequest.php | 3 ++- lib/Cake/Test/Case/Network/CakeRequestTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index cf4227382..047f6b138 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -232,7 +232,8 @@ class CakeRequest implements ArrayAccess { } elseif (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '://') === false) { $uri = $_SERVER['REQUEST_URI']; } elseif (isset($_SERVER['REQUEST_URI'])) { - if (strpos($_SERVER['REQUEST_URI'], '?') !== false && strpos($_SERVER['REQUEST_URI'], '://') > strpos($_SERVER['REQUEST_URI'], '?')) { + $qPosition = strpos($_SERVER['REQUEST_URI'], '?'); + if ($qPosition !== false && strpos($_SERVER['REQUEST_URI'], '://') > $qPosition) { $uri = $_SERVER['REQUEST_URI']; } else { $uri = substr($_SERVER['REQUEST_URI'], strlen(FULL_BASE_URL)); diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index a9a0e7e37..e45d870b6 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -141,7 +141,7 @@ class CakeRequestTest extends CakeTestCase { $request = new CakeRequest(); $this->assertEquals('some/path', $request->url); - $_SERVER['REQUEST_URI'] = FULL_BASE_URL.'/other/path?url=http://cakephp.org'; + $_SERVER['REQUEST_URI'] = FULL_BASE_URL . '/other/path?url=http://cakephp.org'; $request = new CakeRequest(); $this->assertEquals('other/path', $request->url); }