Welcome Guest, Not a member yet? Register   Sign In
output->cache() Not Caching Correctly due to incorrect uri in md5($uri)
#2

[eluser]haydenp[/eluser]
Me again ...

I find it strange that no one else has come across this bug? Recently on another site using a fresh CI install (same version as above) I came across this exact same issue ... to add to my above post I've added the debugging code and results:

_write_cache

Inside the above method I added:

Code:
echo '<p>_write_cache ... uri = ' . $uri;
echo '<p>_write_cache ... base_url = ' . $CI->config->item('base_url');
echo '<p>_write_cache ... index_page = ' . $CI->config->item('index_page');
echo '<p>_write_cache ... uri_string = ' . $CI->uri->uri_string();

The result:

_write_cache ... uri = http://10.9.9.5/mysite/index.php//contro.../var2/var3
_write_cache ... base_url = http://10.9.9.5/mysite/
_write_cache ... index_page = index.php/
_write_cache ... uri_string = /controllername/method/var1/var2/var3

_display_cache

Code:
echo '<p>_display_cache ... uri = ' . $uri;
echo '<p>_display_cache ... base_url = ' . $CFG->item('base_url');
echo '<p>_display_cache ... index_page = ' . $CFG->item('index_page');
echo '<p>_display_cache ... uri_string = ' . $URI->uri_string;

The result:

_display_cache ... uri = http://10.9.9.5/mysite/index.php/control.../var2/var3
_display_cache ... base_url = http://10.9.9.5/mysite/
_display_cache ... index_page = index.php
_display_cache ... uri_string = /controllername/method/var1/var2/var3

Conclusion

In _write_cache(), $CI->config->item('index_page') returns the config index page and incorrectly APPENDS a '/' to the end. To fix I modified _write_cache()...

From:

Code:
$uri =    $CI->config->item('base_url').
    $CI->config->item('index_page').
    $CI->uri->uri_string();

To:

Code:
$uri =    $CI->config->item('base_url').
    str_replace('/', '', $CI->config->item('index_page')).
    $CI->uri->uri_string();

Anyone?


Messages In This Thread
output->cache() Not Caching Correctly due to incorrect uri in md5($uri) - by El Forum - 07-20-2009, 04:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB