Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DOS CRLF line endings in wp-config.php and some other files #936

Closed
pluraltouch opened this issue Dec 15, 2024 · 5 comments
Closed

DOS CRLF line endings in wp-config.php and some other files #936

pluraltouch opened this issue Dec 15, 2024 · 5 comments

Comments

@pluraltouch
Copy link

pluraltouch commented Dec 15, 2024

After a fresh install using wordpress:6.7.1-php8.3-apache image, and wordpress:cli image, wp-config.php contains DOS line endings: 0d0a after each line. Some other files could be also affected, for example license.txt.

I use wp core install to set up the site in wordpress:cli image.

@tianon
Copy link
Member

tianon commented Jan 6, 2025

This matches the upstream line endings: https://github.com/WordPress/WordPress/blob/24fcd3467390f7a263670291d3508f1814c8130f/wp-config-sample.php

$ wget -qO- 'https://github.com/WordPress/WordPress/raw/24fcd3467390f7a263670291d3508f1814c8130f/wp-config-sample.php' | file -
/dev/stdin: PHP script, ASCII text, with CRLF line terminators

$ wget -qO- 'https://github.com/WordPress/WordPress/raw/24fcd3467390f7a263670291d3508f1814c8130f/wp-config-sample.php' | hexdump -C | tail
00000c80  64 65 66 69 6e 65 28 20  27 41 42 53 50 41 54 48  |define( 'ABSPATH|
00000c90  27 2c 20 5f 5f 44 49 52  5f 5f 20 2e 20 27 2f 27  |', __DIR__ . '/'|
00000ca0  20 29 3b 0d 0a 7d 0d 0a  0d 0a 2f 2a 2a 20 53 65  | );..}..../** Se|
00000cb0  74 73 20 75 70 20 57 6f  72 64 50 72 65 73 73 20  |ts up WordPress |
00000cc0  76 61 72 73 20 61 6e 64  20 69 6e 63 6c 75 64 65  |vars and include|
00000cd0  64 20 66 69 6c 65 73 2e  20 2a 2f 0d 0a 72 65 71  |d files. */..req|
00000ce0  75 69 72 65 5f 6f 6e 63  65 20 41 42 53 50 41 54  |uire_once ABSPAT|
00000cf0  48 20 2e 20 27 77 70 2d  73 65 74 74 69 6e 67 73  |H . 'wp-settings|
00000d00  2e 70 68 70 27 3b 0d 0a                           |.php';..|
00000d08

@tianon
Copy link
Member

tianon commented Jan 6, 2025

(In other words, this is expected behavior.)

@pluraltouch
Copy link
Author

pluraltouch commented Jan 7, 2025

then the question raises: why?

  1. other files have unix file ending in the very same use case in the very same directory
  2. in linux this could be any time an issue, I mean some tools do not expect dos line endings and signal errors or misinterpret the input this case...

@LaurentGoderre
Copy link
Member

@pluraltouch this comes directly from the package that wordpress releases. It would need to be addressed there.

@tianon
Copy link
Member

tianon commented Jan 7, 2025

It's a totally fair question -- upstream has made the intentional choice though.

My guess would be because it's common for users to do a file share of their WordPress instance to another system where they edit the files, and that system is often Windows (or was, anyhow), so it's easier to use Windows line-endings which work reasonably in both systems than the opposite.

Regardless of what upstream's motivation of this is, we're not going to override it -- our copy of the wp-config-sample.php uses the same line endings, and if upstream ever swaps theirs, we will follow suit (as we do when they update comments, whitespace, etc): https://github.com/docker-library/wordpress/commits/HEAD/wp-config-docker.php

Additional to that, if you're using wp core install, it downloads the WordPress installation you're using directly (we don't provide it in any way), so it's not something we even could override without patching WP-CLI (which is something we won't do).

@tianon tianon closed this as completed Jan 7, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants