Doc #73142 [Ver]: php_strip_whitespace does not work on files with short tags
| From: | rob dot bast at gmail dot com | Date: | Thu, 22 Sep 2016 10:10:33 +0000 |
| Subject: | Doc #73142 [Ver]: php_strip_whitespace does not work on files with short tags | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13932@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73142&edit=1
ID: 73142
User updated by: rob dot bast at gmail dot com
Reported by: rob dot bast at gmail dot com
Summary: php_strip_whitespace does not work on files with
short tags
Status: Verified
Type: Documentation Problem
Package: *General Issues
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I see. Thank you for clarifying that. I will relay this to the user that originally submitted an
issue to our project.
https://github.com/composer/composer/issues/5701
Previous Comments:
------------------------------------------------------------------------
[2016-09-22 09:57:19] requinix@php.net
php_strip_whitespace() respects the value of short_open_tag. If you have it disabled then the
function will not know to interpret what you are using as PHP code and will not strip the whitespace
from it.
The docs don't mention that.
------------------------------------------------------------------------
[2016-09-22 09:52:41] rob dot bast at gmail dot com
Sorry, expected result should be:
php -r 'var_dump(php_strip_whitespace("test.php"));'
Command line code:1:
string(4) "<?\n "
------------------------------------------------------------------------
[2016-09-22 09:51:24] rob dot bast at gmail dot com
Description:
------------
Using php_strip_whitespace on a file that makes use of the short tag notation <? does not result
in any whitespace being stripped (such as docblocks etc).
This could/should be explicitly mentioned in the documentation.
Test script:
---------------
<?
/**
* does not get removed
*/
Expected result:
----------------
% php -r 'var_dump(php_strip_whitespace("test.php"));'
Command line code:1:
string(7) "<?\n "
Actual result:
--------------
% php -r 'var_dump(php_strip_whitespace("test.php"));'
Command line code:1:
string(37) "<?\n\n/**\n * does not get removed\n */\n\n"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73142&edit=1