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

Fix Mailbox testBadInput test on PHP 8.2 #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bytestream
Copy link
Contributor

Horde_Imap_Client_Data_Format_Mailbox_MailboxTest::testBadInput fails on PHP 8.2.

This is due to mb_convert_encoding("foo\0", 'UTF7-IMAP', 'UTF-8'); producing foo&AAA- on PHP 8.2, and foo\0 on prior versions. See https://onlinephp.io/c/20a6. The change in data means the stream is no longer considered to contain "binary" data and so the parent::binary() check fails.

The change in mb_convert_encoding behaviour doesn't appear to be documented, but is covered at https://github.com/php/php-src/blob/b96b88b669370e1d85b6e98e359649d73b548029/ext/mbstring/tests/utf7imap_encoding.phpt#L29

It's unclear to me if this change is correct... @slusarz wrote the test back in 2014.

$ vendor/bin/phpunit --filter=testBadInput
PHPUnit 9.5.27 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 00:00.021, Memory: 12.00 MB

There was 1 failure:

1) Horde_Imap_Client_Data_Format_Mailbox_MailboxTest::testBadInput
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-''
+Binary String: 0x666f6f00

/v/test/Horde/Imap/Client/Data/Format/Mailbox/MailboxTest.php:117

FAILURES!
Tests: 2, Assertions: 3, Failures: 1.

@what-the-diff
Copy link

what-the-diff bot commented Dec 12, 2022

  • The encoding of the mailbox is changed from $this->_encoding to utf8.

ralflang added a commit that referenced this pull request Mar 28, 2024
Fix Mailbox testBadInput test on PHP 8.2 (Bytestream #23 for FRAMEWORK_6_0)
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.

1 participant