Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imap_last_error() #523

Closed
slo-nik opened this issue Jun 28, 2020 · 9 comments
Closed

imap_last_error() #523

slo-nik opened this issue Jun 28, 2020 · 9 comments
Labels
needs investigation This will be tested / debugged or checked out. phpunit Adding or updating PHPUnit tests for this issue.

Comments

@slo-nik
Copy link

slo-nik commented Jun 28, 2020

Environment (please complete the following information):

  • PHP IMAP version: 4.1.0
  • PHP Version: 7.2.31
  • Type of execution: Web Server

Your Text
Файл Imap.php, статический метод open(). Не отрабатывается код для вывода imap_last_error(), выводит сообщение об ошибке:

imap_open(): Couldn't open stream

       $result = \imap_open($mailbox, $username, $password, $options, $n_retries, $params);

        if (!$result) {
             $lastError = \imap_last_error();

            if ('' !== \trim($lastError)) {
                 throw new UnexpectedValueException('IMAP error:'.$lastError);
            }

            throw new UnexpectedValueException('Could not open mailbox!', 0, self::HandleErrors(\imap_errors(), 'imap_open'));
        }

В таком варианте код отрабатывается, срабатывает исключение с выводом imap_last_error(), добавил @ перед imap_open()

IMAP error:Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Authentication failed.

$result = @imap_open($mailbox, $username, $password, $options, $n_retries, $params);
        /**/
        if ('' !== \trim($lastError)) {
                 throw new UnexpectedValueException('IMAP error:'.$lastError);
            }

Как можно это исправить?

@bapcltd-marv bapcltd-marv mentioned this issue Jun 29, 2020
bapcltd-marv added a commit to bapcltd/php-imap that referenced this issue Jun 30, 2020
bapcltd-marv added a commit to bapcltd/php-imap that referenced this issue Jun 30, 2020
@Sebbo94BY
Copy link
Collaborator

I've merged the fix from @bapcltd-marv to the develop branch. Please test. :)

@Sebbo94BY Sebbo94BY added needs investigation This will be tested / debugged or checked out. phpunit Adding or updating PHPUnit tests for this issue. labels Jul 27, 2020
@slo-nik
Copy link
Author

slo-nik commented Jul 27, 2020

I've merged the fix from @bapcltd-marv to the develop branch. Please test. :)

А что проверять? Я проверил перед тем, как Вам писать.

@bapcltd-marv
Copy link
Contributor

i.e. does the error still occur with the latest code.

@Dasinfomedia2
Copy link

i.e. does the error still occur with the latest code.

Yes.
Warning: imap_open(): Couldn't open stream {mail.xxxx.com:993/imap/ssl/novalidate-cert}INBOX

if I write the 'imap_open' function manually for test then it works.

@mrcodefinger
Copy link

Same here

@mrcodefinger
Copy link

The solution for me is leaving out OP_SECURE of
$mailbox->setConnectionArgs( CL_EXPUNGE // expunge deleted mails upon mailbox close );

@Sebbo94BY
Copy link
Collaborator

Is this issue still reproduceable with the latest release 4.3.0?

@Sebbo94BY
Copy link
Collaborator

Might be also related to the issue #571.

@Sebbo94BY
Copy link
Collaborator

Closing this issue for now. If the issue should still occur, please comment this issue or open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation This will be tested / debugged or checked out. phpunit Adding or updating PHPUnit tests for this issue.
Projects
None yet
Development

No branches or pull requests

5 participants