Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Undefined variable section in Message class #5

Copy link
Copy link

Description

@Gizmo091
Issue body actions
Q A
javanile/php-imap2 version 0.1.7
PHP version 7.4.3
IMAP provider imap.gmail.com

Summary

Trying to use imap2_bodystruct, the function throw a notice for an undefined variable called section.

Current behavior

A call to imap2_bodystruct function trigger an "undefined variable" notice.

Notice: Undefined variable: section in .../vendor/javanile/php-imap2/src/Message.php on line 186

Indeed, the $section variable is never declared or instantiated.

 public static function bodyStruct($imap, $messageNum, $flags = 0)
    {
        if (is_a($imap, Connection::class)) {
            $client = $imap->getClient();
            #$client->setDebug(true);

            $messages = $client->fetch($imap->getMailboxName(), $messageNum, false, ['BODY['.$section.']']);

            if ($section) {
                return $messages[$messageNum]->bodypart[$section];
            }

            return $messages[$messageNum]->body;
        }

        return imap_fetchstructure($imap, $messageNum, $flags);
    }
Reactions are currently unavailable

Metadata

Metadata

Type

No type

Projects

Status
No status
Show more project fields

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.