You are here

function _phpmailer_stack in PHPMailer 8.3

Same name and namespace in other branches
  1. 5.2 phpmailer.module \_phpmailer_stack()
  2. 6.3 phpmailer.module \_phpmailer_stack()
  3. 6.2 phpmailer.module \_phpmailer_stack()
  4. 7.4 phpmailer.module \_phpmailer_stack()
  5. 7.3 phpmailer.module \_phpmailer_stack()

Implements a FIFO stack to store extracted quoted strings.

1 string reference to '_phpmailer_stack'
phpmailer_parse_address in ./phpmailer.module
Extract address and optional display name of an e-mail address.

File

./phpmailer.module, line 143
Integrates the PHPMailer library for SMTP e-mail delivery.

Code

function _phpmailer_stack($matches = NULL) {
  $string = $matches[0];
  static $stack = [];
  if ($string == "\1") {

    // Unescape quoted characters (3.2.4) to prevent double escaping.
    return str_replace([
      '\\"',
      '\\\\',
    ], [
      '"',
      '\\',
    ], array_shift($stack));
  }

  // Remove surrounding quotes and push on stack.
  array_push($stack, substr($string, 1, -1));

  // Return placeholder substitution. 0x01 may never appear outside a quoted
  // string (3.2.3).
  return "\1";
}