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

Wrong redirected URL when installing new WordPress bedrock 1.13.0 #493

Closed
4 tasks done
nhanledev opened this issue Feb 20, 2020 · 6 comments · Fixed by #494
Closed
4 tasks done

Wrong redirected URL when installing new WordPress bedrock 1.13.0 #493

nhanledev opened this issue Feb 20, 2020 · 6 comments · Fixed by #494

Comments

@nhanledev
Copy link

Description

When installing new WordPress with latest Bedrock version 1.13.0, the redirected URL to installation page is wrong, which is http://domain/WP_HOME/wp/wp-admin/install.php

image

If I change the URL to the right one which is http://domain/wp/wp-admin/install.php, all assets such as JS or CSS files' URLs are wrong.

image

Steps to reproduce

  1. Clone bedrock from github
  2. Run composer install
  3. Access the bedrock to install new WordPress/BedRock instance

Expected behavior: Redirected to domain/wp/wp-admin/install.php

Actual behavior: Redirected to domain/WP_HOME/wp/wp-admin/install.php

Reproduces how often: 100%

Versions

You can get this information from referencing CHANGELOG.md. Also, please include the OS and what version of the OS you're running.

BedRock 1.13.0

Additional information

I believe that the behavior is from phpdotenv v4 because I have tried to upgrade to this version before, but it went crazy and I could not handle it.

austinpray added a commit to austinpray/bedrock-testbed that referenced this issue Feb 20, 2020
@austinpray
Copy link
Contributor

austinpray commented Feb 20, 2020

Not seeing this with this testbed: https://github.com/austinpray/bedrock-testbed/tree/br-493 (the current bedrock master is checked into the repo at this branch)

How exactly are you running this locally?

@austinpray
Copy link
Contributor

austinpray commented Feb 20, 2020

Ah never mind I can reproduce this by using the .env.example provided in the repo

image

https://github.com/austinpray/bedrock-testbed/tree/br-493-reproduced

working vs not working

It's obviously an issue with WP_SITEURL='${WP_HOME}/wp'. '${WP_HOME}/wp' is not interpolated.

@austinpray
Copy link
Contributor

austinpray commented Feb 20, 2020

@nhanledev see if this fixes your issue #494, it does for me

https://github.com/vlucas/phpdotenv/blob/92c402dad814531e4fd0469cf867302ef1f59b47/UPGRADING.md#v3-to-v4

The behaviour when parsing single quoted strings has now changed, to mimic the behaviour of bash. It is no longer possible to escape characters in single quoted strings, and everything is treated literally. As soon as the first single quote character is read, after the initial one, then the variable is treated as ending immediately at that point. When parsing unquoted or double quoted strings, it is now possible to escape dollar signs, to forcefully avoid variable interpolation. Escaping dollars is not mandated, in the sense that if a dollar is present, and not following by variable interpolation sytnax, this is allowed, and the dollar will be treated as a literal dollar. Finally, interpolation of variables is now performed right to left, instead of left to right, so it is possible to nest interpolations to allow using the value of a variable as the name of another for further interpolation.

@nhanledev
Copy link
Author

nhanledev commented Feb 20, 2020

@austinpray I can confirm that changing from a single quote to double-quote of WP_SITEURL in .env file fixes this issue.

@austinpray
Copy link
Contributor

Sweet! Tagged a bugfix release https://github.com/roots/bedrock/releases/tag/1.13.1

@ali-awwad
Copy link

On Azure Web Apps this issue persists, this is because the environment variables are defined in the "Application Settings", so there is no way to add single qoutes or double qoutes.

so my only option was just to write the full domain twice, like WP_HOME=http://example.test and WP_SITEURL=http://example.test/wp

Also, for some reason the Azure web app does not like the salt keys to have curly brackets and other symbols, so i wrote them with only numbers and letters and few symbols .

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 a pull request may close this issue.

3 participants