Re: win32 line endings again
| From: | Frank M. Kromann | Date: | Sat, 17 Sep 2005 14:32:37 +0000 |
| Subject: | Re: win32 line endings again | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-1656@lists.php.net to get a copy of this message | ||
A simple str_replace() before the explode would do the same.
- Frank
> Hi
>
> I just did a completely new checkout and came across a problem with
> windows line endings again in the generator scripts. This patch fixes
> the problem.
>
>
> diff -u -w -b -r1.28 override.php
> --- override.php 4 Sep 2005 06:02:27 -0000 1.28
> +++ override.php 17 Sep 2005 05:35:30 -0000
> @@ -92,9 +92,11 @@
>
> function _parse_block($block, $blocklineno, $file_name)
> {
> - if (strpos($block, "\n"))
> - list($line, $rest) = explode("\n", $block, 2);
> - else {
> + if (strpos($block, "\n")) {
> + $test = preg_split('/\r\n|\n/',ltrim($block));
> + $line = array_shift($test);
> + $rest = implode("\n",$test);
> + } else {
> $line = $block;
> $rest = '';
> }
>
> --
>
> Tom
>
> --
> PHP-GTK Development Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>