This line:
|
if (!is_null($content) && (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $content))) { |
Was Added around 4 months ago and broke email sending with attachments in this commit: 563eef8
Pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/ works only for shorter strings up to 98288 characters. After that limit it fails and preg_match returns false. Which makes this setContent function to fail to recognise the correct base64 string.
This is due to catastrophic backtracking of regexp. More on this issue eg. here: https://medium.com/@catcatduatiga/when-regex-eats-the-cpu-a-postmortem-of-catastrophic-backtracking-in-php-and-how-tiny-patterns-can-64b2aa64a530
Because of this issue, only quite small attachments can be sent.
This can be fixed eg. with replacing the validation to base64_encode and base64_decode and comparison with oryginal string.
Temporary solution we found ist to switch off PRCE JIT temporaily ini_set("pcre.jit", "0"); but it is only temporary.
This line:
brevo-php/lib/Model/SendSmtpEmailAttachment.php
Line 267 in be204da
Was Added around 4 months ago and broke email sending with attachments in this commit: 563eef8
Pattern
/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/works only for shorter strings up to 98288 characters. After that limit it fails and preg_match returns false. Which makes this setContent function to fail to recognise the correct base64 string.This is due to catastrophic backtracking of regexp. More on this issue eg. here: https://medium.com/@catcatduatiga/when-regex-eats-the-cpu-a-postmortem-of-catastrophic-backtracking-in-php-and-how-tiny-patterns-can-64b2aa64a530
Because of this issue, only quite small attachments can be sent.
This can be fixed eg. with replacing the validation to base64_encode and base64_decode and comparison with oryginal string.
Temporary solution we found ist to switch off PRCE JIT temporaily
ini_set("pcre.jit", "0");but it is only temporary.