![]() |
base_url() not working after upgrade - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: base_url() not working after upgrade (/showthread.php?tid=91684) |
base_url() not working after upgrade - talu - 09-18-2024 Hi, I updated CI4 from 4.3.5 to 4.4.8. Since I have a problem with base_url(). In the controller called by https://site.com, base_url() gives the correct information. In the controller called by https://site.com/app/logs for example, base_url() falls in error " Unable to parse https://" : Trace:
Any idea ? Thank you in advance RE: base_url() not working after upgrade - kenjis - 09-18-2024 (09-18-2024, 03:47 AM)talu Wrote: In the controller called by https://site.com/app/logs for example, base_url() falls in error " Unable to parse https://" : I don't know why, but "https://" is not a valid URL. So no wonder that CI4 is not able to parse. Check why the URI is "https://". RE: base_url() not working after upgrade - talu - 09-30-2024 I found the root cause of the problem. The management of URIs is different between the CI versions. RE: base_url() not working after upgrade - Jan Zelenka - 10-17-2024 Hi @talu , would you be willing to share the details? I seem to be encountering similar issue (https://forum.codeigniter.com/showthread.php?tid=91814) and your solution might just help me out. Thanks in advance! RE: base_url() not working after upgrade - talu - 10-17-2024 Hi Jan, My problem came from this code (loginfilter with Myth library) : PHP Code: public function before(RequestInterface $request, $params = null) I replaced the code by this : PHP Code: public function before(RequestInterface $request, $params = null) I hope that's helpful. RE: base_url() not working after upgrade - ndriana - 10-21-2024 Hi, I am having almost the same problem. I upgraded from 4.0 to 4.5. I understand that there was a serious change in handling URI in 4.4. My problem is, I used to extend the URI class, and in Services, in the uri() function, I have: return new \App\Libraries\EXT_URI($uri); EXT_URI is a class extending URI. It used to work. But now CI 4.4 and up says that $uri = service('uri'); // returns the current SiteURI instance. I have a lot of mess with base_url() and such. I tried to extend the new class SiteURI instead and return the extended one in service, but it gives a fatal error: Fatal error: Uncaught TypeError: CodeIgniter\HTTP\SiteURI::__construct(): Argument #1 ($configApp) must be of type Config\App, null given Sorry if it deviates from the original thread but I think it's related. I understand that there is a big change in 4.4 but I haven't found any how to update. |