User tests: Successful: Unsuccessful:
I've set $result as false by default in the addAttachment() method.
JFactory::getMailer()->addAttachment(array());
will show a PHP Notice:
Notice: Undefined variable: result in /libraries/joomla/mail/mail.php on line 479
I've bumped my head against a wall for so long until I figured this out; $result never gets initialized because the array has 0 elements and this part won't run:
foreach ($path as $key => $file)
{
if (!empty($name))
{
$result = parent::addAttachment($file, $name[$key], $encoding, $type);
}
else
{
$result = parent::addAttachment($file, $name, $encoding, $type);
}
}
So we'll end up with an unset $result here:
if ($result === false)
None
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-10-08 14:13:19 |
Closed_By | ⇒ | zero-24 |
I ran into this same error. On line 479 it is checking if ($results === false), but $results is undefined. Not sure why this is in there, but I commented out the whole if statement and I no longer get the error. I'm sure it serves a purpose, but until it is fixed this is my working solution. There are 2 other places in mail.php that this same code occurs FYI.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11568.