bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

Wrong redirected URL when installing new WordPress bedrock 1.13.0

Open nhanledev opened this issue 6 years ago • 6 comments

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.

nhanledev avatar Feb 20 '20 04:02 nhanledev

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 avatar Feb 20 '20 05:02 austinpray

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 avatar Feb 20 '20 05:02 austinpray

@nhanledev see if this fixes your issue https://github.com/roots/bedrock/pull/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.

austinpray avatar Feb 20 '20 05:02 austinpray

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

nhanledev avatar Feb 20 '20 05:02 nhanledev

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

austinpray avatar Feb 20 '20 05:02 austinpray

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 .

ali-awwad avatar Jun 13 '23 16:06 ali-awwad