Bug Scriptcase 10.2.001 – AWS SES Email Export Fails Under PHP 8.2

Bug Report: Scriptcase 10.2.001 – AWS SES Email Export Fails Under PHP 8.2

Product: Scriptcase 10.2.001
Development Build: 1
Production Library: 1.0.006 – Build 9
Operating System: Windows 11 (Build 22631, x64)
Web Server: Apache 2.4.65 (Win64), mod_fcgid 2.3.10-dev
PHP Version: 8.2.29 (development environment)
Production Server PHP: 8.2.35
Email Service: Amazon SES (eu-west-1 / Ireland)
Affected Feature: Standard Grid Export by Email using sc_send_mail_api()

Problem Description

When using the standard Scriptcase Grid “Export by Email” functionality with Amazon SES, two consecutive fatal errors occur.

Both errors originate from Scriptcase’s supplied libraries rather than custom application code.

The errors suggest that the email export implementation contains PHP 8.2 compatibility issues and an incorrect AWS SES request structure.

Issue 1: Removed PHP Function in Mail MIME Library

Error:

Fatal error: Uncaught Error:
Call to undefined function get_magic_quotes_runtime()

File:

scriptcase/prod/third/Mail/mime.php

Line: 498

Call stack:

Mail_mime->file2str()
Mail_mime->addAttachment()
sc_send_mail_api()
grid_maintenance_tasks_export_email.php

Cause:

The Scriptcase-supplied Mail MIME library still calls get_magic_quotes_runtime().

This function was removed in PHP 8.0 and is no longer available in PHP 8.2.

Workaround:

Replace:

get_magic_quotes_runtime()

with:

false

This eliminates the first fatal error and allows execution to continue to the AWS SES request.

Recommended permanent fix:

Update the bundled Mail MIME library to a version fully compatible with PHP 8.2.

Issue 2: Invalid AWS SES Destinations Array

After correcting the first error, a second fatal error occurs.

Error:

Fatal error: Uncaught TypeError:
Unsupported operand types: string + int

File:

phar://.../scriptcase/prod/third/aws.phar/
Aws/Api/Serializer/QueryParamBuilder.php

Line: 108

Call stack:

QueryParamBuilder->format_list()
QueryParamBuilder->format()
QuerySerializer->__invoke()
AwsClient->sendRawEmail()
sc_send_mail_api()
grid_maintenance_tasks_export_email.php

The problem originates in the Scriptcase implementation of sc_send_mail_api().

File:

scriptcase/app/<project>/_lib/lib/php/nm_api.php

Lines: 1006–1017

Original Scriptcase Code

$arr_message['Destinations'] =
    $arr_message['Destination'];

$arr_message['Destinations'] = [];

$arr_message['Destinations']['ToAddresses'] =
    implode(';', $arr_message['Destination']['ToAddresses']);

if (
    isset($arr_message['Destination']['CcAddresses']) &&
    count($arr_message['Destination']['CcAddresses']) > 0
) {
    $arr_message['Destinations']['CcAddresses'] =
        implode(';', $arr_message['Destination']['CcAddresses']);
}

if (
    isset($arr_message['Destination']['BccAddresses']) &&
    count($arr_message['Destination']['BccAddresses']) > 0
) {
    $arr_message['Destinations']['BccAddresses'] =
        implode(';', $arr_message['Destination']['BccAddresses']);
}

unset($arr_message['Destination']);

$result = $instance->sendRawEmail($arr_message);

Cause

The AWS SES sendRawEmail() operation expects Destinations to contain a numerically indexed array of email addresses.

However, the Scriptcase implementation constructs an associative array containing ToAddresses, CcAddresses, and BccAddresses as keys, with semicolon-separated strings as values.

During AWS SDK serialization, QueryParamBuilder attempts to perform arithmetic on a string key, resulting in:

Unsupported operand types: string + int

Proposed Fix

Replace the recipient conversion block with:

$recipientAddresses = array_merge(
    $arr_message['Destination']['ToAddresses'] ?? [],
    $arr_message['Destination']['CcAddresses'] ?? [],
    $arr_message['Destination']['BccAddresses'] ?? []
);

$arr_message['Destinations'] = array_values(
    array_unique($recipientAddresses)
);

unset($arr_message['Destination']);

This produces the numerically indexed recipient list expected by AWS SES.

The proposed fix assumes that the original recipient fields already contain arrays of email address strings. The separate MIME headers must continue to handle To, Cc, and Bcc correctly.

Status: The incorrect array construction has been identified. The proposed fix requires complete validation of email delivery and attachments.

Steps to Reproduce

  1. Create a standard Scriptcase Grid application.
  2. Enable the built-in Export by Email functionality.
  3. Configure email delivery using Amazon SES.
  4. Select records and attempt to send the export by email.
  5. Observe the first fatal error in Mail/mime.php.
  6. Apply the PHP compatibility workaround.
  7. Repeat the email export.
  8. Observe the second fatal error in the AWS SDK serializer.

Expected Behavior

The Grid should successfully generate the export, attach the generated file, and send the message through AWS SES without PHP fatal errors.

Actual Behavior

The built-in email export fails during MIME attachment processing. After correcting that problem, it fails during AWS SES request serialization.

Request to Scriptcase Development Team

Please investigate and provide an official correction for:

  1. The obsolete get_magic_quotes_runtime() call in the bundled Mail MIME library.
  2. The incorrect Destinations array construction in sc_send_mail_api() when using Amazon SES with sendRawEmail().

Both problems affect standard Scriptcase functionality and should be corrected in the distributed libraries rather than requiring local modifications.

Please also verify the fixes with PHP 8.2.35, including email attachments and To/Cc/Bcc handling.

Local modifications may be overwritten by future Scriptcase updates or application deployments.

Thank you.