Wrong file pointer at mime_parser.php

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
BRStuff
Posts: 1
Joined: Wed Apr 13, 2022 10:23 pm

Wrong file pointer at mime_parser.php

Post by BRStuff »

Script URL: inc/mail/mime_parser.php
Version of script: 3.2.5
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

In function ReadMessageBody line 2075 "fclose($stream);" uses a wrong file pointer. Must be $file.

Code: Select all

Function ReadMessageBody($message, &$body, $prefix)
{
	if(IsSet($message[$prefix]))
		$body = $message[$prefix];
	elseif(IsSet($message[$prefix.'File']))
	{
		$path = $message[$prefix.'File'];
		if(!($file = @fopen($path, 'rb')))
			return($this->SetPHPError('could not open the message body file '.$path));
		for($body = '', $end = 0;!$end;)
		{
			if(!($data = @fread($file, $this->message_buffer_length)))
			{
				$this->SetPHPError('Could not open the message body file '.$path);
				fclose($stream);
				return(0);
			}
			$end=feof($file);
			$body.=$data;
		}
		fclose($file);
	}
	else
		$body = '';
	return(1);
}
I found the bug because I had a mail that the parser, when reading the cache file, opened but couldn't do the fread. With file_get_contents it can open and read. Does anyone have any idea what the problem could be?
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Wrong file pointer at mime_parser.php

Post by Klemen »

That's a third party library we use, but yes, it does look like an error, should be $file.

Not sure why fread wouldn't work. You can try removing @ before fread and turning Debug mode ON in Hesk settings, then see if you get any error messages or notices.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply