开发者

script dying out and contents are being prompted for download due to fsockopen - how do I fix it

I'm working with zend framework and recently had terrible issue swith my code. Actually I'm developing a webfront for emails and users enter their mail server details and are able to check on their email via my system.

The issue is that whenever I would try to connect to a mailserver my system just dies out sometimes and instead I am prompted to download the index page i.e the page being run - of course I'd end up with an empty page but thats not supposed to be happening.

I did some checking and found that the code is dying in the Zend_Mail_Protocol_Imap class in the connect function and that too at the code which says:

$this->_socket = fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION);

on line 94 in the link posted.

What do I do here how do I set up a check to work around this atleast find out whats happened 开发者_如何转开发here :(

You can check out from a screenshot what I'm seeng here: alt text http://img714.imageshack.us/img714/6558/problemh.jpg

EDIT==================

My code which I'm actually running [I'm just using the libraries here] is :

$mailConfig = array('host' => $current_dept->incoming_server,
'port'=>$current_dept->incoming_port,                       'folder'=>$mbox_name,
'user' =>$current_dept->email,
'password' =>$current_dept->email_psd);


$mailConfig['ssl'] ='ssl';

try{
    if($mail)
        unset($mail);

    $mail = new Zend_Mail_Storage_Imap($mailConfig);


    }catch (Zend_Mail_Exception $e) {
        var_dump($e);
        exit;
    }

The fsockopen is in the Zend_mail_protocol_Imap class which is subsequently invoked within the constructor of the zend_mail_storage_imap class.

despite being enclosed in a try catch block its not even running the try catch block.

Plus the file prompted for download is just an empty file with the same name as the php file being executed.

EDIT ==========================

I've found the problem - for some reason an exception is being thrown and its nested really deep. But what I don't understand is this behavior of prompting to download a file instead of outputting any form of error message or so.


Firstly, Whats actually in the PHP file thats forced to be downloaded.

also, the zend code is not the problem i think.

In your Controller where you run $???->connect(); try doing this

try
{
    $mail->connect();
}cache(Zend_Mail_Protocol_Exception $Exception)
{
     die("Debug: " . $Exception->toString());
}

To see if that has any affect ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜