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

[BUG] zend_mm_heap corrupted / Segmentation fault: 11 #320

Closed
blieb opened this issue May 15, 2019 · 12 comments
Closed

[BUG] zend_mm_heap corrupted / Segmentation fault: 11 #320

blieb opened this issue May 15, 2019 · 12 comments
Labels
need help Your support is required to solve this issue. needs investigation This will be tested / debugged or checked out.

Comments

@blieb
Copy link

blieb commented May 15, 2019

Environment (please complete the following information):

  • PHP IMAP version: 3.0.14 / 3.0.15
  • PHP Version: 7.1.12 / 7.2.1
  • Type of execution: CLI

Describe the bug
Since PHP IMAP Version 3.0.14 I get error when I try to use getMail.

I've tried it on 2 php versions,
on php 7.1.12 I get the error: "zend_mm_heap corrupted"
on php 7.2.1 I get the error: "Segmentation fault: 11"

I'm running this on CLI on MacOS. Php versions from MAMP PRO.
PHP IMAP Version 3.0.13 works fine.
To Reproduce
Steps to reproduce the behavior.

The used code:

        $mailbox = new \PhpImap\Mailbox(
            $config['server'],
            $config['username'],
            $config['password']
        );
        $mailsIds = $mailbox->searchMailbox('ALL');
        $mail = $mailbox->getMail($mailIds[0]);

Expected behavior
Getting email

Screenshots / Outputs
WHen I run it I get on php 7.1 "zend_mm_heap corrupted"
I also tried it on php 7.2 but then I get error "Segmentation fault: 11"

@blieb blieb added the needs investigation This will be tested / debugged or checked out. label May 15, 2019
@Sebbo94BY
Copy link
Collaborator

From which mail server do you try to get emails from? GMail / G Suite, Microsoft Exchange, Own?

Do you have installed and configured any kind of caching? On the CLI, you may want to disable caching in your php.ini: opcache.enable_cli=0 (if opcache is used for example)

See https://stackoverflow.com/questions/2247977/what-does-zend-mm-heap-corrupted-mean.

@Sebbo94BY Sebbo94BY added the need help Your support is required to solve this issue. label May 15, 2019
@blieb
Copy link
Author

blieb commented May 15, 2019

Yes already played with that. but no success, I do not have caching enabled.

The mailserver I use is an own mailserver. Running dovecot imap server. (directadmin server)

@Sebbo94BY
Copy link
Collaborator

My server is running with Dovecot 2.2.27, but I don't have these problems.

Can you please show your customized Dovecot configuration (only non-default settings)? doveconf -an

Then I can compare these settings with those from mine and check, what's causing the issue.

@blieb
Copy link
Author

blieb commented May 15, 2019

I also have this problem when I try to use gmail. So it is not server specific.

I'm going to try it on an other system. Mac and linux.

@blieb
Copy link
Author

blieb commented May 15, 2019

I've running the code inside cakephp framework. Looks like it only fails in combination with that. I continue testing to see if I can find the reason.

@Sebbo94BY
Copy link
Collaborator

CakePHP also provides a caching solution: https://book.cakephp.org/3.0/en/core-libraries/caching.html

Is this maybe causing this issue?

@blieb
Copy link
Author

blieb commented May 15, 2019

Cakephp only caches data. and only when you ask it too.

I've created a new cakephp 3.7 project. Here an updated reproduce step by step:
composer create-project --prefer-dist cakephp/app

go to project folder (app)

composer require php-imap/php-imap

add file: src/Command/testCommand.php (create folder Command)

<?php

namespace App\Command;
use Cake\Console\Arguments;
use Cake\Console\Command;
use Cake\Console\ConsoleIo;

class TestCommand extends Command {

    public function execute(Arguments $args, ConsoleIo $io)
    {
        $mailbox = new \PhpImap\Mailbox(
            '{imap.gmail.com:993/imap/ssl}INBOX', // IMAP server and mailbox folder
            '', // Username for the before configured mailbox
            '' // Password for the before configured username
        );
        $mailsIds = $mailbox->searchMailbox('ALL');
        foreach ($mailsIds as $mailId) {
            $mail = $mailbox->getMail($mailId);
            print_r($mail);
            exit;
        }
    }
}

(fill in username/password)

run command by running: bin/cake test

@blieb
Copy link
Author

blieb commented May 15, 2019

Looks like a problem with iconv. It crashes at this line:

$convertedString = function_exists('iconv') ? @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) : null;

@Sebbo94BY
Copy link
Collaborator

With which error message does it crash?

Just remove the @ sign in front of iconv(, if you don't see any error messages.

@Sebbo94BY
Copy link
Collaborator

@blieb I've changed a few things. Can you please test it again?

Use the current code of the develop branch:
composer require php-imap/php-imap:dev-develop

@blieb
Copy link
Author

blieb commented May 16, 2019

Yes the current dev version works without problems

@Sebbo94BY
Copy link
Collaborator

Great! These changes are already included in the latest release v3.0.16. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need help Your support is required to solve this issue. needs investigation This will be tested / debugged or checked out.
Projects
None yet
Development

No branches or pull requests

2 participants