cvs: pear /PHP_Compat/Compat/Function php_strip_whitespace.php
| From: | Aidan Lister | Date: | Fri, 27 Aug 2004 15:07:49 +0000 |
| Subject: | cvs: pear /PHP_Compat/Compat/Function php_strip_whitespace.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-23367@lists.php.net to get a copy of this message | ||
aidan Fri Aug 27 11:07:49 2004 EDT
Modified files:
/pear/PHP_Compat/Compat/Function php_strip_whitespace.php
Log:
Strips whitespace but removes the last ?> for some reason
http://cvs.php.net/diff.php/pear/PHP_Compat/Compat/Function/php_strip_whitespace.php?r1=1.2&r2=1.3&ty=u
Index: pear/PHP_Compat/Compat/Function/php_strip_whitespace.php
diff -u pear/PHP_Compat/Compat/Function/php_strip_whitespace.php:1.2
pear/PHP_Compat/Compat/Function/php_strip_whitespace.php:1.3
--- pear/PHP_Compat/Compat/Function/php_strip_whitespace.php:1.2 Fri Aug 27 10:53:37 2004
+++ pear/PHP_Compat/Compat/Function/php_strip_whitespace.php Fri Aug 27 11:07:49 2004
@@ -15,7 +15,7 @@
// | Authors: Aidan Lister <aidan@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: php_strip_whitespace.php,v 1.2 2004/08/27 14:53:37 aidan Exp $
+// $Id: php_strip_whitespace.php,v 1.3 2004/08/27 15:07:49 aidan Exp $
/**
@@ -25,7 +25,7 @@
* @package PHP_Compat
* @link http://php.net/php_strip_whitespace
* @author Aidan Lister <aidan@php.net>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @since PHP 5
* @require PHP 4.0.1 (trigger_error)
*/
@@ -37,7 +37,9 @@
$file = implode('', file($file));
// Remove whitespace
- // FIXME
+ $file = preg_replace('#(<\?php\n?)(.*?)(\?>)#se',
+ "'\\1' . str_replace(\"\n\", ' ', '\\2') .
'\\3'",
+ $file);
// Remove comments
$file = preg_replace('#//[^\n]+#s', '', $file);