Hi All,
I updated my CLI program from 4.1.1 to 4.1.2 with all files updated as specified in the update documentation and I got this error
/---------------------------
[ErrorException]
Undefined array key "cid"
at SYSTEMPATH\Email\Email.php:763
Backtrace:
1 SYSTEMPATH\Email\Email.php:763
CodeIgniter\Debug\Exceptions()->errorHandler(2, 'Undefined array key "cid"', 'C:\\CI_system_4_1_2\\Email\\Email.php', 763)
2 APPPATH\Controllers\SBSEmail.php:74
CodeIgniter\Email\Email()->setAttachmentCID('C:\\webroot\\sbs_archievement_emails\\public\\images\\uow.jpg')
3 SYSTEMPATH\CodeIgniter.php:931
App\Controllers\SBSEmail()->index()
4 SYSTEMPATH\CodeIgniter.php:439
CodeIgniter\CodeIgniter()->runController(Object(App\Controllers\SBSEmail))
5 SYSTEMPATH\CodeIgniter.php:339
CodeIgniter\CodeIgniter()->handleRequest(null, Object(Config\Cache), false)
6 FCPATH\index.php:36
CodeIgniter\CodeIgniter()->run()
/--------------------------------------
I replaced the EMAIL\EMAIL.PHP function "setAttachmentCID($filename)" with the version from 4.1.1 (see below) and the program worked again.
Running the CLI program on PHP 8.06
public function setAttachmentCID($filename)
{
/* -----------
foreach ($this->attachments as $i => $attachment)
{
if ($attachment['name'][0] === $filename)
{
$this->attachments[$i]['multipart'] = 'related';
$this->attachments[$i]['cid'] = uniqid(basename($attachment['name'][0]) . '@', true);
return $attachment['cid'];
}
}
------- */
for ($i = 0, $c = count($this->attachments); $i < $c; $i ++)
{
if ($this->attachments[$i]['name'][0] === $filename)
{
$this->attachments[$i]['multipart'] = 'related';
$this->attachments[$i]['cid'] = uniqid(basename($this->attachments[$i]['name'][0]) . '@', true);
return $this->attachments[$i]['cid'];
}
}
return false;
}