• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug in extended helpers?

#11
[eluser]olof84[/eluser]
Thanks for taking time to check the problem. I don't know why I don´t get any error. Here is my code:

MY_string_helper.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('this_bug_test'))
{
    function this_bug_test()
    {
        echo 'Inside this bug test.';
    }
}

My controller:
Code:
public function index($adv_slug)
    {
        
        echo this_bug_test();
}
When I run it this shows up: 'Inside this bug test.'.

Here are my autoload files:
Code:
$autoload['packages'] = array();
$autoload['libraries'] = array('database', 'session');
$autoload['helper'] = array('url', 'sh_basic_helper');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array('model_user');

EDIT:
I see now that only some of my extended helpers are available (without me adding them to autoload). The MY_string_helper and MY_url_helper are available, but not MY_text_helper/MY_array_helper. The first two helpers have I used before in my project, but removed from the autoload file. The last two have I never used before.

#12
[eluser]CroNiX[/eluser]
I don't know what to tell you. I copied your MY_string_helper.php and did your test. I got the expected error regarding an undefined function (this_bug_test()) until I put $this->load->helper('string') before this_bug_test();

So, again, this does not happen in a stock CI even with the exact code you posted used. SOMETHING in your code is doing it. It could be a library that you are loading also loads some helpers. All I can say is this isn't a CI bug. If you don't believe me use a fresh CI install and repeat your experiment and you'll see that the string helper does not load by itself, even if extended, unless it is told to - somewhere.

Edit: MY_url_helper functions are available to you because you autoload the url helper, which in turn automatically loads the MY_url_helper if it exists.

#13
[eluser]olof84[/eluser]
Yeah, sorry that explains the extended url helper. But the MY_string_helper remains an mystery. But like you said, it is probably an error in my project.

Thanks for your time and effort.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.