diff options
author | Andrey Andreev <narf@devilix.net> | 2015-03-30 09:37:47 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-03-30 09:37:47 +0200 |
commit | 5bd58a94f541e67853e2ee78b39c0cdbc7b7c669 (patch) | |
tree | e675fb3f46e1257d183eee5f64c153aa6688bd59 | |
parent | 138d0f54fc92ec57f48865850f84594c59b50797 (diff) | |
parent | cbf3a559583bcc9055fcee5f7564ca847d0b8dff (diff) |
Merge pull request #3710 from toulet/develop
Fix an "strpos(): Empty needle" warning
-rw-r--r-- | system/core/URI.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/system/core/URI.php b/system/core/URI.php index e96749456..2211e3665 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -205,13 +205,16 @@ class CI_URI { $query = isset($uri['query']) ? $uri['query'] : ''; $uri = isset($uri['path']) ? $uri['path'] : ''; - if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) + if (isset($_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']))); + 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 |