wecodemore / wpstarter

Easily bootstrap whole site Composer packages for WordPress.
https://wecodemore.github.io/wpstarter/
MIT License
246 stars 35 forks source link

Default WP_HOME causes fatal error #76

Closed Chrico closed 6 years ago

Chrico commented 6 years ago

Describe the bug If i don't have a WP_HOME defined in my .env-file, WPStarter is falling back to a generated one. This generation uses set_url_scheme which is not available at the point it is called. I can see following fatal thrown:

Fatal error: Uncaught Error: Call to undefined function set_url_scheme() in E:\Projects\xyz/customer-website\public\wp-config.php:121

To Reproduce

  1. Create an .env file with following without WP_HOME.
  2. run composer wpstarter to generate `wp-config.php
  3. Open project in Browser.

Expected behavior v1: Function should be included or a custom implementation.

v2: WPStarter should not set "defaults" by assuming something in wp-config.php - it should show an error on CLI when "required" constants are not set.

gmazzap commented 6 years ago

Thanks, I will fix the issue.

Regarding Expected behavior v2, WP_HOME is not strictly required. Surely is recommended. I could document that (it is already documented in the .env.example).

The fallback to server name or localhost can work in many cases... for the others, the env var is there. Don't want to throw a fatal for tis reason

gmazzap commented 6 years ago

@Chrico the issue should be fixed. Special behavior of WP_HOME is also documented now: https://github.com/wecodemore/wpstarter/blob/version-3/docs/03-WordPress-Integration.md#wp_home

Chrico commented 6 years ago

Thanks! Looks fine to me.

Commit: https://github.com/wecodemore/wpstarter/commit/c94123d3b4af10f12bf22a661d3c1aba1d63d52a