Welcome Guest, Not a member yet? Register   Sign In
base_url() not working after upgrade
#1

(This post was last modified: 09-18-2024, 03:48 AM by talu.)

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:



  1. SYSTEMPATH\HTTP\SiteURI.php : 120   —  CodeIgniter\HTTP\Exceptions\HTTPException::forUnableToParseURI ()

    Code:
    113        $uri = $this->baseURL . $indexPageRoutePath;
    114
    115        // applyParts
    116        // d($uri);
    117        $parts = parse_url($uri);
    118        // trace();exit;
    119        if ($parts === false) {
    120            throw HTTPException::forUnableToParseURI($uri);
    121        }
    122       
    123        $parts['query']    = $query;
    124        $parts['fragment'] = $fragment;
    125        // d($parts);exit;
    126        // d($this);
    127        $this->applyParts($parts);

  2. SYSTEMPATH\HTTP\SiteURI.php : 396   —  CodeIgniter\HTTP\SiteURI->__construct ()

    Code:
    389        $config            = clone config(App::class);
    390        $config->indexPage = '';
    391
    392        $host = $this->getHost();
    393        // d($relativePath);
    394        // d($config);
    395        // d($host);exit;
    396        $uri = new self($config, $relativePath, $host, $scheme);
    397
    398        // Support protocol-relative links
    399        if ($scheme === '') {
    400            return substr((string) $uri, strlen($uri->getScheme()) + 1);
    401        }
    402       
    403        return (string) $uri;

  3. SYSTEMPATH\Helpers\url_helper.php : 58   —  CodeIgniter\HTTP\SiteURI->baseUrl ()

    Code:
    51      */
    52    function base_url($relativePath = '', ?string $scheme = null): string
    53    {
    54        $currentURI = Services::request()->getUri();
    55        // d($currentURI);exit;
    56        assert($currentURI instanceof SiteURI);
    57
    58        return $currentURI->baseUrl($relativePath, $scheme);
    59    }
    60 }
    61
    62 if (! function_exists('current_url')) {
    63    /**
    64      * Returns the current full URL based on the Config\App settings and IncomingRequest.
    65      *

  4. APPPATH\Controllers\LogsController.php : 17   —   base_url()
  5. SYSTEMPATH\CodeIgniter.php : 943   —  App\Controllers\LogsController->index ()







Any idea ?


Thank you in advance
Reply


Messages In This Thread
base_url() not working after upgrade - by talu - 09-18-2024, 03:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB