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

Bug: Limit to subdomains, not work #5959

Closed
szajens opened this issue May 4, 2022 · 3 comments · Fixed by #5961
Closed

Bug: Limit to subdomains, not work #5959

szajens opened this issue May 4, 2022 · 3 comments · Fixed by #5961
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@szajens
Copy link

szajens commented May 4, 2022

PHP Version

8.0

CodeIgniter4 Version

4.1.9 develop

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

No response

What happened?

https://codeigniter4.github.io/CodeIgniter4/incoming/routing.html#limit-to-subdomains
You can restrict it to any subdomain by setting the value to an asterisk, (*). If you are viewing from a URL that does not have any subdomain present, this will not be matched:

// Limit to any sub-domain
$routes->add('from', 'to', ['subdomain' => '*']); <-not work

Steps to Reproduce

Change in file: https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/Router/RouteCollection.php#L1354

change old: unset($host[count($host)]);
to new: unset($host[count($host)-1]);

Expected Output

bug fix

Anything else?

No response

@szajens szajens added the bug Verified issues on the current code behavior or pull requests that will fix them label May 4, 2022
@szajens
Copy link
Author

szajens commented May 4, 2022

or array_pop($host)

and could change line 1358 to : array_pop($host)

@kenjis
Copy link
Member

kenjis commented May 4, 2022

@szajens Thank you!
This must be a bug.

@kenjis
Copy link
Member

kenjis commented May 5, 2022

I sent a PR #5961.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants