-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: site_url() does not use alt Config #7211
Conversation
55c6e87
to
4bdfb13
Compare
4bdfb13
to
1df9612
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of adding another parameter to these functions.
? rtrim($config->baseURL, '/ ') . '/' | ||
: $request->getUri()->getBaseURL(); | ||
if ($useConfig) { | ||
$url = rtrim($config->baseURL, '/ ') . '/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for not using
$url = rtrim($config->baseURL, '/ ') . '/';
every time - no matter what request type we are dealing with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For multiple domain support.
https://codeigniter4.github.io/CodeIgniter4/changelogs/v4.3.0.html#multiple-domain-support
* | ||
* @throws HTTPException For invalid paths. | ||
* @throws InvalidArgumentException For invalid config. | ||
*/ | ||
function _get_uri(string $relativePath = '', ?App $config = null): URI | ||
function _get_uri(string $relativePath = '', ?App $config = null, bool $useConfig = false): URI | ||
{ | ||
$config ??= config('App'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$config ??= config('App'); | |
if ($config === null) { | |
$appConfig = config('App'); | |
} |
Maybe we can do something like this? This way, we could still distinguish the custom config type from the default one. And no additional parameters for the functions would be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sent a new PR #7215
Description
From https://forum.codeigniter.com/showthread.php?tid=86549
Checklist: