Doc #73142 [Opn->Ver]: php_strip_whitespace does not work on files with short tags
| From: | requinix@php.net | Date: | Thu, 22 Sep 2016 09:57:20 +0000 |
| Subject: | Doc #73142 [Opn->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-13931@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
Updated by: requinix@php.net
Reported by: rob dot bast at gmail dot com
Summary: php_strip_whitespace does not work on files with
short tags
-Status: Open
+Status: Verified
Type: Documentation Problem
-Package: Documentation problem
+Package: *General Issues
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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