6.0.0-alpha10
5/14/25

[#15050] PHP 8 breaks Horde_Imap_Client_Socket::_fetchCmd
Summary PHP 8 breaks Horde_Imap_Client_Socket::_fetchCmd
Queue Horde Framework Packages
Type Bug
State Unconfirmed
Priority 3. High
Owners
Requester anna.larch (at) gmx (dot) net
Created 02/17/2021 (1547 days ago)
Due
Updated 02/17/2021 (1547 days ago)
Assigned
Resolved
Milestone
Patch Yes

History
02/17/2021 08:59:01 AM anna (dot) larch (at) gmx (dot) net Comment #2 Reply to this comment

[Show Quoted Text - 29 lines]
Please note this breaks IMAP for PHP 7 instead, so it's just a work 
around for the  moment.

02/17/2021 08:29:17 AM anna (dot) larch (at) gmx (dot) net Comment #1
State ⇒ Unconfirmed
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ PHP 8 breaks Horde_Imap_Client_Socket::_fetchCmd
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ Yes
New Attachment: Screenshot from 2021-02-17 09-28-20.png Download
Reply to this comment
When using Horde_Imap_Client_Fetch_Query::headers like this:


                $query->headers(
                        'references', [ 'references' ], [
                                'cache' => true,
                                'peek' => true,
                        ]
                );

the string comparison in Horde_Imap_Client_Socket::_fetchCmd Line 2932 
doesn't work as expected any more in PHP8.


It results in an IMAP error:

C: 3 UID FETCH 904 (ENVELOPE FLAGS INTERNALDATE 
BODY.PEEK[references.HEADER.FIELDS (REFERENCES)])
S: 3 BAD Error in IMAP command UID FETCH: Invalid BODY[..] section 
(0.001 + 0.000 secs).

One option would be to replace the line:

$cmd = ( $key == 0 )

with:

$cmd = ( is_string( $key ) === true && ( $key == 0 ) === false )

Saved Queries