ID: 37662 User updated by: mg at evolution515 dot net Reported By: mg at evolution515 dot net -Status: Bogus +Status: Open Bug Type: Unknown/Other Function Operating System: Debian/Sarge PHP Version: 5.1.4 New Comment:
Ok, changed to PHP/5.1.4-1.dotdeb.1. Still the error. CLI as libapache2 produce the same error. $ php BUG.php strpos() has been successfuly run! Fatal error: Call to undefined function () in /home/www/Projekte/flyerpilot.de/htdocs.dev/MimeMagic/BUG.php on line 41 OK COPY AND PASTE FOLLWING SCRIPT AND TRY AGAIN! -------------------------------------------------- <?php 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 (([EMAIL PROTECTED]($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"); ?> Previous Comments: ------------------------------------------------------------------------ [2006-06-01 08:54:06] [EMAIL PROTECTED] Bug update collision, setting back to bogus. ------------------------------------------------------------------------ [2006-06-01 08:47:33] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2006-06-01 08:42:38] [EMAIL PROTECTED] # php /tmp/2.php strpos() has been successfuly run! I'm sure you don't need a class to check if strpos() finds '\r' or '\n' in strings. ------------------------------------------------------------------------ [2006-06-01 08:38:52] mg at memedia dot de Have you replaced... $lfPos = strpos($this->magicBuffer, "\n"); ....with... $lfPos = strpos($this->magicBuffer, "\r"); ...? ------------------------------------------------------------------------ [2006-06-01 08:37:36] mg at evolution515 dot net Ok, and strpos() doesn't find any \n on the search string although there are surely \n in there. I've just seen that was another bug. So this bug is surely realted, but please fix that "undefined function ()" in "if ($a || $b)" at last!! ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/37662 -- Edit this bug report at http://bugs.php.net/?id=37662&edit=1