Welcome Guest, Not a member yet? Register   Sign In
updated to current ci but base_url() defect
#1

the base_url function does not return the port number like it used to
What can I use instead?
Reply
#2

@cupboy1

How is your base url defined in your config file?
Reply
#3

(This post was last modified: 04-14-2017, 12:04 PM by cupboy.)

It's blank in both config files (older version, and current version). Definitely a bug with the new codeignitor version. I don't know what older version I'm currently running but it's a version 3 version, just not the latest one. My IIS settings are correct.
Reply
#4

(This post was last modified: 04-14-2017, 12:55 PM by ciadmin.)

Not a bug with either CodeIgniter or codeignitor:
https://www.codeigniter.com/user_guide/i...-not-empty
Reply
#5

(This post was last modified: 04-14-2017, 08:49 PM by cupboy.)

I was able to fix it by going into system/core/Config.php and changing __construct to do it the old way, using  $__SERVER['HTTP_HOST'] instead of the new, non-working way which used $__SERVER['SERVER_ADDR']

Hasn't been thoroughly tested yet but works so far.

Now that I've gotten a way into the site I get a new error:

Call to a member function unset_userdata() on null

Strange stuff.
Reply
#6

Never a good idea to mess with code in system. The change was made because using HTTP_HOST can lead to a host header injection attack.

If you absolutely want to do it "your way", the proper approach would be to "extend" the Config class ... https://www.codeigniter.com/user_guide/g...core-class
Reply
#7

I've taken a look at that. I intend to study it further.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB