From b3a3c4f09e160432072f3dc770efe0443556da9a Mon Sep 17 00:00:00 2001 From: Frederik Schubert Date: Thu, 2 May 2019 17:43:09 +0200 Subject: [PATCH] Don't add a closing php-tag This PR removes the closing `?>` PHP tag from generated files. [PSR-2](https://www.php-fig.org/psr/psr-2/) states: > The closing `?>` tag MUST be omitted from files containing only PHP. A problem might occur if files with any character after the closing tag are used with `include` or `require`. It might trigger an output and disallow HTTP header manipulation. See the popular [_headers already sent_](https://stackoverflow.com/a/8028987/1847340) debate on SO. --- Source/Modules/php.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 994fbd7de..b192d6f6e 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -676,7 +676,7 @@ public: Delete(s_fakeoowrappers); s_fakeoowrappers = NULL; } - Printf(f_phpcode, "%s\n?>\n", s_phpclasses); + Printf(f_phpcode, "%s\n", s_phpclasses); Delete(f_phpcode); return SWIG_OK;