bloginfo('name');

bloginfo('description');

Some are just too stupid?

Juli 1st, 2006 by Blu:RayNe

Da hat man mal einen Fehler gefunden, postet ihn folglich im PHP-Bugtracker und stellt schließlich fest, dass ein idiotischer Entwickler dort gerade seinen Job tut.

Und dann erkennt er nicht einmal, dass die angefangene Klasse zu dem werden sollte, was ich später dann gott-sei-dank  Funktionalität in PEAR::MIME_Type gefunden hab, auch wenn ich kurzzeitig shell_exec() versuch habe,

class MagicReader {
   
    private $magicBuffer = ;
    private $magicFile;
   
    private $fp;
   
   
    function __construct($filename=null) {
        if (is_string($filename))
            $this->openMagicFile($filename);
        $this->convert();   
        $this->closeMagicFile();
    }
   
   
    function openMagicFile($filename)   {
        $this->magicFile = @fopen($filename, ‘r’);
        return $this->magicFile;
    }
   
   
    function closeMagicFile()   {
        return @fclose($this->magicFile);
    }
   
   
    function convert() {
        while ($line = $this->readLine()) {
            echo $line;
            die();
        }
    }
   
   
    private function readLine()
    {
       
        while ((!@feof($this->magicFile)) || (strlen($this->magicBuffer)>0))
{   
            $lfPos = strpos($this->magicBuffer, "\r"); // cahnge this value to
R!
            if ($lfPos !==false) {
                $this->magicBuffer = substr($this->magicBuffer, $lfPos);
                return substr($this->magicBuffer, $lfPos)."|";
            }
            $this->magicBuffer = @fread($this->magicFile, 4096);
        }
       
        // if we reached this position we are at the end of the file!
       
        $out = $this->magicBuffer; // assign return output
       
        if (empty($this->magicBuffer)) {// if buffer is already empty we are
really at the end
            return false;
        }
           
        $this->magicBuffer = ; // clear out buffer
       
        return $out;   
    }

   
    function __destruct() {
        $this->closeMagicFile();
    }
}

$str = "That’s a\rlittle Test!";
echo (strpos($str, "\r")) ? "strpos() has been successfuly run!" :
"nothing found but successfuly run!";

$reader = new MagicReader("magic");

Wie es weiterging könnt ihr hier nachlesen…

Tja, den Fehler kann ich immer noch nachvollziehen, und eigntlich wollte ich bis Abends warten, bis ein anderer Entwickler seinen Dienst tut. Aber ehrlich gesagt, jetzt hab ich keine Lust mehr!

Filed under Allgemein having

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.