summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorCyrille TOULET <iwa@hestia.nerdit.fr>2015-03-29 14:53:16 +0200
committerCyrille TOULET <iwa@hestia.nerdit.fr>2015-03-29 14:53:16 +0200
commitead327f7fd53946dc61dbd0562d9f7f3d19e802c (patch)
tree71159972d7d02476fc89e36e083f9bdf6e5864a3 /system/core
parentdabdbe4d90e8a80d8224dfa0f387c06deae9cf8f (diff)
Fix an "strpos(): Empty needle" warning
Signed-off-by: Cyrille TOULET <cyrille.toulet@linux.com>
Diffstat (limited to 'system/core')
-rw-r--r--system/core/URI.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/system/core/URI.php b/system/core/URI.php
index 43a0a9caa..9c8e37f0f 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -205,14 +205,17 @@ class CI_URI {
$query = isset($uri['query']) ? $uri['query'] : '';
$uri = isset($uri['path']) ? $uri['path'] : '';
- if (!empty($_SERVER['SCRIPT_NAME']) && strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
- {
- $uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME']));
- }
- elseif (!empty($_SERVER['SCRIPT_NAME']) && strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
- {
- $uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
- }
+ if (isset($_SERVER['SCRIPT_NAME'][0]))
+ {
+ if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
+ {
+ $uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME']));
+ }
+ elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
+ {
+ $uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
+ }
+ }
// This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
// URI is found, and also fixes the QUERY_STRING server var and $_GET array.