php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73142 php_strip_whitespace does not work on files with short tags
Submitted: 2016-09-22 09:51 UTC Modified: 2017-04-05 19:22 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rob dot bast at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: *General Issues
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2016-09-22 09:51 UTC] 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"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-22 09:52 UTC] 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:57 UTC] requinix@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: *General Issues
 [2016-09-22 09:57 UTC] 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 10:10 UTC] rob dot bast at gmail dot com
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
 [2017-04-05 19:22 UTC] peehaa@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: peehaa
 [2017-04-05 19:22 UTC] peehaa@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC