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

Remove any trailing slash from application name #368

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

jasonmccreary
Copy link
Contributor

@jasonmccreary jasonmccreary commented Dec 6, 2024

This PR addresses two, minor issues.

First, due to a logic bug when testing for Herd or Valet, a default .test extension could never be reached. This ultimately leads to APP_URL always being http://localhost instead of a potentially valid http://app-name.test.

Second, if a developer appends a trailing slash to the name everything is installed and the application runs. However, all tests will fail until the developer realizes the APP_URL was set to http://app-name/.test. While an arguably an incorrect use case, it's a pretty easy fix to avoid such an annoying experience.

@jasonmccreary
Copy link
Contributor Author

jasonmccreary commented Dec 6, 2024

This test case may not be possible in other environments as they have different behavior for gethostbyname. It runs locally on my Mac as it can lookup a local domain.

Might be easiest to remove this test case. But I will leave it in case the reviewer (on Mac) wishes to run it locally to verify my change first.

@taylorotwell taylorotwell merged commit 54bd7c9 into laravel:master Dec 6, 2024
2 of 12 checks passed
@jasonmccreary jasonmccreary deleted the dx-fixes branch December 6, 2024 18:47
@@ -159,7 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->validateDatabaseOption($input);
$this->validateStackOption($input);

$name = $input->getArgument('name');
$name = mb_rtrim($input->getArgument('name'), '/\\');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks the minimum required PHP version. This function is introduced on PHP 8.4

Copy link
Contributor Author

@jasonmccreary jasonmccreary Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symfony has a "polyfill" which adds native PHP functions like this to older versions. Tests pass for me locally running PHP 8.3 on Mac.

Did you experience an error or just review the code statically and see this function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is safe to be used since Laravel Framework requires ext-mbstring in it's own composer.json

#373 PR will address this further by throwing an exception if it detects PHP doesn't have the required extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants