cubecart / v6

CubeCart Version 6
https://cubecart.com
72 stars 59 forks source link

Syntax Error #3617

Closed bhsmither closed 1 month ago

bhsmither commented 1 month ago

In documents.email.inc.php, near line 346, there is:

if (!preg_match("/{$EMAIL_CONTENT}/", $_POST['template'][$key])) {

The problem is the $ will expand $EMAIL_CONTENT when in double-quotes. PHP complains about an undefined variable.

Using single-quotes is still not enough because $ and {} are meta-characters in regex patterns.

Suggest:

if (!preg_match('/\{\$EMAIL_CONTENT\}/', $_POST['template'][$key])) {

or, more simply:

if (strpos($_POST['template'][$key], '$EMAIL_CONTENT') === false) {
abrookbanks commented 1 month ago

Thank you.