Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 4 base_url() bug
#1
Bug 
(This post was last modified: 04-22-2021, 11:58 AM by Muzikant.)

If I will add a file parameter to base_url() function, it will add an equal sign (=) to the end, which should not be there. I am considering this as a bug. I tested it in PHP 7.4 and 8.

The code

PHP Code:
echo base_url('favicon.ico' '?' 'v101'); 

will output

Code:
http://localhost/favicon.ico?v101=

I am using these parameters to force browsers to get the new versions of a files.
Reply
#2

1. base_url() . 'favicon.ico' . '?' . 'v101';
2. do not use base_url()
3. base_url('favicon.ico' . '?' . 'v=101')
4. configure caching on the server.
Reply
#3

(This post was last modified: 04-23-2021, 06:18 AM by Muzikant.)

(04-22-2021, 02:26 PM)iRedds Wrote: 1. base_url() . 'favicon.ico' . '?' . 'v101';
2. do not use base_url()
3. base_url('favicon.ico' . '?' . 'v=101')
4. configure caching on the server.

  1. I know, but this is not fixing a bug in the framework. My thread is not call for a help, but a bug report. There is no problem in CodeIgniter 3.
  2. Why not to use base_url()? It should be used for files instead of site_url(), like it is in the documentation.
  3. I did not get the point. This is exactly what I wrote what is causing the problem.
  4. No, it is a good practice to do it the way I am doing it to get an immediate effect. But maybe I am doing it wrong (tell me why).

(04-22-2021, 02:26 PM)iRedds Wrote: 3. base_url('favicon.ico' . '?' . 'v=101')

Oh, I get it. My mistake. I understand why it is adding an equal sign at the end now. In my case it is considered as the parameter name and expecting a value.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB