Skip to content

Conversation

@jcdelepine
Copy link

Commit 0738f13 introduced a regression by hardcoding utf8 encoding instead of using dynamic encoding selection. This breaks compatibility with IMAP servers not announcing UTF8=ACCEPT (like Cyrus), making it impossible to access or create mailboxes with accented characters (e.g., "Envoyé", "testé").

The fix restores dynamic encoding based on $this->_encoding:

  • Servers with UTF8=ACCEPT use Mailbox_Utf8 (utf8)
  • RFC-compliant servers use Mailbox (utf7imap)

Also adapts testBadInput to handle PHP 8.2+ behavior where mb_convert_encoding now encodes null bytes as '&AAA-' instead of truncating the string.

Fixes: 0738f13 (Fix Mailbox testBadInput test on PHP 8.2)

Commit 0738f13 introduced a regression by hardcoding utf8 encoding
instead of using dynamic encoding selection. This breaks compatibility
with IMAP servers not announcing UTF8=ACCEPT (like Cyrus), making it
impossible to access or create mailboxes with accented characters
(e.g., "Envoyé", "testé").

The fix restores dynamic encoding based on $this->_encoding:
- Servers with UTF8=ACCEPT use Mailbox_Utf8 (utf8)
- RFC-compliant servers use Mailbox (utf7imap)

Also adapts testBadInput to handle PHP 8.2+ behavior where
mb_convert_encoding now encodes null bytes as '&AAA-' instead of
truncating the string.

Fixes: 0738f13 (Fix Mailbox testBadInput test on PHP 8.2)
@what-the-diff
Copy link

what-the-diff bot commented Oct 12, 2025

PR Summary

  • Updated Constructor Use in Mailbox.php
    Instead of using the previously hardcoded 'utf8' mode, the constructor was updated in Mailbox.php to utilize the object's built-in encoding property. This change allows the system to be more flexible and handle different encoding modes.

  • Introduced New Test Case in MailboxTest.php
    This PR includes a new test case in MailboxTest.php. The objective of this test is to confirm the system's ability to correctly manage null bytes (empty data points). Some recent changes in PHP version 8.2 and later require an adjustment in behaviour which this test verifies.

  • Adjusted Assertions in testBadInput() Method
    The PR involves tweaking assertions (statements of expected results) in the testBadInput() method. The goal of this update is to cater to the different ways null bytes are handled across various versions of PHP, ensuring the software functions properly, regardless of the PHP version.

@TDannhauer TDannhauer self-requested a review October 28, 2025 17:55
Copy link
Contributor

@TDannhauer TDannhauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGFM

@TDannhauer TDannhauer requested a review from ralflang October 28, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants