Page 1 of 1

RSS Feed broken

Posted: Fri Sep 21, 2007 8:24 pm
by ormus7577
Hi,

Some recently updated plugin must include a blank/line-feed. Because previously working feeds no longer validate, see:

http://tool.ormus.info/index.php?/feeds/index.rss2

I've checked a number of files already without success, any way to find this thing?

Posted: Fri Sep 21, 2007 11:59 pm
by strcat
Newline at the end of serendipity_config_local.inc.php?

Posted: Sat Sep 22, 2007 12:08 pm
by garvinhicking
Hi!

Usually a language file or something like that. Go through each of the plugin PHP files of the plugins andlanguage files you updated, and search for whitespace before <?php or after ?>.

Regards,
Garvin

Posted: Sat Sep 22, 2007 2:05 pm
by ormus7577
As this seem to happen every now and then, can you think of any way to automatically check for those nasty blanks? (haven't found it yet, pita, as I can't recall what plugins I've updated...)

Posted: Sun Sep 23, 2007 11:54 am
by garvinhicking
Hi!

I've often thought about a way to check this, but actually I don't have a clue how to do that. It would be nice if the PHP engine could tell you that, where it happens.

Regards,
Garvin

Posted: Mon Sep 24, 2007 8:54 am
by ormus7577
We're talking about the first <? and last ?> of a file only, right? Shouldn't it be possible to have some regular expression check for blanks before/after those tags? Shame I've slept through those regexp lessons :(

Posted: Thu Sep 27, 2007 3:07 pm
by garvinhicking
Hi!

Hab gerade mal ein kleines script entwickelt, das fand bei mir in der italiienischen glossary-sprachdateiund der englischen audioscrobbler datei wohl ein linebreak.

Kannst es ja mal probieren:

Code: Select all

<?php

function check($dir) {
  $dh = opendir($dir);
  while(false !== ($file = readdir($dh))) {
     if ($file == '.' || $file == '..') continue;
     if (is_dir($dir . '/' . $file)) {
         check($dir . '/' . $file);
     } elseif (preg_match('@\.php$@', $file)) {
         $p = file_get_contents($dir . '/' . $file);
         if (preg_match('@^(.+)<\?php@iU', $p, $m)) {
             echo $dir . '/' . $file . ' has padding space' . "\n";
         } elseif (preg_match('@\?>(.+)$@iU', $p, $m)) {
             if ($m[1] === "\n" || (ord($m[1][0]) === 13 && ord($m[1][1]) === 0
                 continue;
             }
             for($i=0; $i <= strlen($m[1]); $i++) {
                 $char = $m[1][$i];
                 echo $i . "/" . ord($char) . ": " . dechex(ord($char)) . "\n";
             }
             echo $dir . '/' . $file . ' has trailing space' . "\n";
             print_r($m);
         }
     }
  }
}

check('.');
Grüße,
Garvin