summaryrefslogtreecommitdiffstats
path: root/system/core/Loader.php
diff options
context:
space:
mode:
authorFabio Spampinato <fabiospampinato@users.noreply.github.com>2017-01-11 15:27:45 +0100
committerGitHub <noreply@github.com>2017-01-11 15:27:45 +0100
commite82d91b0b322b4770441d00480d908be959ac175 (patch)
tree8e9a0801247b4c80bb6ef29f2dc01df5867b054c /system/core/Loader.php
parent27647c9a8b5cd5a0e1fd78123316f359fe61a672 (diff)
Fixed regex used for loading helpers
We want to exactly match a dot, so we have to escape it. I found the bug because in my project I load an helper named `session_php_helper.php`, so the `_php` part gets removed and the `session_helper.php` helper gets loaded instead, this way not even an error was shown.
Diffstat (limited to 'system/core/Loader.php')
-rw-r--r--system/core/Loader.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index e9813a7c9..7279e8833 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -590,7 +590,7 @@ class CI_Loader {
{
$filename = basename($helper);
$filepath = ($filename === $helper) ? '' : substr($helper, 0, strlen($helper) - strlen($filename));
- $filename = strtolower(preg_replace('#(_helper)?(.php)?$#i', '', $filename)).'_helper';
+ $filename = strtolower(preg_replace('#(_helper)?(\.php)?$#i', '', $filename)).'_helper';
$helper = $filepath.$filename;
if (isset($this->_ci_helpers[$helper]))