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: current_url function not working as expected. #2365

Closed
jayfortner opened this issue Oct 27, 2019 · 3 comments · Fixed by #2407
Closed

Bug: current_url function not working as expected. #2365

jayfortner opened this issue Oct 27, 2019 · 3 comments · Fixed by #2407
Assignees
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Milestone

Comments

@jayfortner
Copy link

jayfortner commented Oct 27, 2019

Describe the bug
Using current_url function produces an unexpected result.
Expecting accurate url, server root with uri string provided instead.
Screenshot attached.
codeigniter-currenturl-bug

CodeIgniter 4 version
Commit # a424b3e of the develop branch.

Affected module(s)
URL Helper.

Expected behavior, and steps to reproduce if appropriate
Expected behavior:

  • Function should return URL as set in the App\Config\App.
    EDIT: Actual expected behavior: the full URL (including segments) of the page where the function is executed. As pointed out by @dafriend .

Steps to reproduce:

  • Call current_url in a view.

Context

  • OS: Mac OS X 10.13.6
  • Web server: Apache 2.4.33
  • PHP version: 7.2.14
@jayfortner jayfortner added the bug Verified issues on the current code behavior or pull requests that will fix them label Oct 27, 2019
@dafriend
Copy link
Contributor

You might be confusing the function current_url() with base_url().
base_url() is the one that returns the setting in App\Config\App

current_url() returns the full URL (including segments) of the page where the function is executed.

@jayfortner
Copy link
Author

@dafriend Not confused. I just wrote a bad expected behavior statement. I'll do my best to update it. I think we all know what this function is supposed to do and if you look at the attached screenshot you can see that current_url is not returning the url as seen in the browser. My reference to App/Config/App was to avoid implying that it should return with the request uri.

@jayfortner
Copy link
Author

Thanks @lonnieezell !

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.

3 participants