php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76618 segfault on imap_reopen
Submitted: 2018-07-13 07:54 UTC Modified: 2020-10-22 16:09 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: slim at inbox dot lv Assigned: girgias (profile)
Status: Closed Package: IMAP related
PHP Version: 7.1.19 OS: linux
Private report: No CVE-ID: None
 [2018-07-13 07:54 UTC] slim at inbox dot lv
Description:
------------
php segfaults randomly on heavy imap_reopen usage with 7.x branches.
From phpng-upgrading docs it looks like on failed mail_open() streamind should be closed, not deleted


Patches

php-inbox-php71-reopen-close.patch (last revision 2018-07-13 07:54 UTC by slim at inbox dot lv)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-13 11:37 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-07-13 11:37 UTC] cmb@php.net
Simple reproducer without mailserver:

<?php
$imap = imap_open('~/good-mailbox', '', '', 0);
var_dump($imap);
$foo = $imap;
var_dump(imap_num_msg($imap));
var_dump(imap_reopen($imap, '~/bad-mailbox'));
var_dump(imap_num_msg($imap));
 [2018-07-16 12:55 UTC] kalle@php.net
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2018-07-16 12:55 UTC] kalle@php.net
Nikita, is this the correct fix (being our presidental php-ng expert)?
 [2018-07-16 14:15 UTC] cmb@php.net
It seems to me the correct fix would be to remove imap_reopen().
Consider how `bool freopen($res)` would work.
 [2018-07-16 20:30 UTC] nikic@php.net
-Status: Assigned +Status: Analyzed -Assigned To: nikic +Assigned To:
 [2018-07-16 20:30 UTC] nikic@php.net
@kalle: Patch looks good to me.
 [2020-10-22 16:09 UTC] girgias@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: girgias
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 06:01:31 2024 UTC