Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix incorrect description on RedirectException (2) #7633

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 28, 2023

Description
Follow-up #7629
Ref #7628 (comment)

A complete URL will be converted to baseURL by base_url(). So it cannot be used with RedirectException since v4.0.0.

<?php

namespace App\Controllers;

use CodeIgniter\Router\Exceptions\RedirectException;

class Home extends BaseController
{
    public function index()
    {
        throw new RedirectException('https://codeigniter.com/foo/bar');
    }
}
$ curl -v http://localhost:8080/
*   Trying 127.0.0.1:8080...
* connect to 127.0.0.1 port 8080 failed: Connection refused
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.87.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Host: localhost:8080
< Date: Wed, 28 Jun 2023 01:33:53 GMT
< Connection: close
< X-Powered-By: PHP/8.1.20
< Cache-Control: no-store, max-age=0, no-cache
< Content-Type: text/html; charset=UTF-8
< Location: http://localhost:8080/foo/bar  <-- Look here
< 
* Closing connection 0

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • [] Conforms to style guide

A complete URL will be converted with base_url().
It may imply a named route.
@kenjis kenjis added bug Verified issues on the current code behavior or pull requests that will fix them documentation Pull requests for documentation only labels Jun 28, 2023
@kenjis kenjis changed the title docs: fix incorrect description on RedirectException docs: fix incorrect description on RedirectException (2) Jun 28, 2023
@kenjis kenjis merged commit 481b4c3 into codeigniter4:develop Jun 28, 2023
@kenjis kenjis deleted the fix-docs-RedirectException-2 branch June 28, 2023 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them documentation Pull requests for documentation only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants