Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Do not remove a single trailing space after PHP close tags #147

Open
redreinard opened this issue Feb 3, 2017 · 0 comments
Open

Do not remove a single trailing space after PHP close tags #147

redreinard opened this issue Feb 3, 2017 · 0 comments

Comments

@redreinard
Copy link

redreinard commented Feb 3, 2017

Prerequisites

Description

I have read and do not intend to re-open the trailing whitespace flamewars.
However, in PHP there is a very specific case where the difference between having a single trailing space, and not changes the output, and thus removing it is destructive to the script.

Steps to Reproduce

  1. PHP file:
<?php
    // ...
?>[trailing space here]
<sometag>

Output: <CR><sometag>

  1. PHP file:
<?php
    // ...
?>[no trailing space as it's been removed by default, thank you]
<sometag>

Output: <sometag>

Expected behavior:

The first space after a closing PHP tag is a language specific indicator. Thou shalt not touch it.

Actual behavior:

You remove the space by default, causing a CR to be missing in the output. This means PHP developers have no choice but to disable whitespace trimming altogether, otherwise by default Atom will damage PHP file output.

Reproduces how often:

100% as it's a PHP feature.

Versions

Additional Information

The reasons for it go back to the days of PHP3 apparently, and it's been kept that way ever since (for backwards compatibility i assume):
http://marc.info/?t=90279165800002&r=1&w=2
It's not well documented.. I can't seem to even find an offical PHP docs page describing it, but it's readily proven:
https://3v4l.org/HEjdr

The issue is that the default behavior of trimming them is destructive to PHP files. I'm not asking for whitespace trimming default settings to be changed at all. You guys decided that a long time ago, but I am asking that the default removal, not steal the first space after a PHP closing tag, for compatibility reasons.

Thank you for your time.

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

No branches or pull requests

2 participants