skip to Main Content

I was running a PHP test development server on localhost and I stumbled across this warning that breaks the site entirely, the error is

PHP Warning: Message: strpos(): Empty needle

and the snippet causing this error is

if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->base_url()) === FALSE OR strpos($form, 'method="get"')))

I tried googling for the error but none gave me a solid answer about it.

2

Answers


  1. Chosen as BEST ANSWER

    Solution found, URL helper wasn't loading, had to load it manually in any form using $this->load->helper('url');, still don't know why autoload doesn't work but I guess i'll find a solution to it, thanks to all fellas especially @ADyson and @nice_dev.


  2. you can run a debugger like xdebug and put break points in the code and stop there and inspect the values or you can log them to the CI files

    log_message('debug', "action ".var_export($action, TRUE));
    log_message('debug', "base url".var_export($CI->config->base_url(), TRUE));
    log_message('debug', "form ".var_export($form, TRUE));
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search