Skip to content

Commit 2b5b259

Browse files
author
Sebastian Krätzig
committed
Issue #198: Added magic function __isset() to fix incorrect booleans for isset() and empty() on IncomingMail[] properties
1 parent 63b4817 commit 2b5b259

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/PhpImap/IncomingMail.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ public function __get($name)
4949
return $this->$name;
5050
}
5151

52+
/**
53+
* The method __isset() is triggered by calling isset() or empty()
54+
* on inaccessible (protected or private) or non-existing properties.
55+
*/
56+
public function __isset($name)
57+
{
58+
self::__get($name);
59+
return isset($this->$name);
60+
}
61+
5262
public function addAttachment(IncomingMailAttachment $attachment)
5363
{
5464
$this->attachments[$attachment->id] = $attachment;

0 commit comments

Comments
 (0)