Skip to content

fix(zend-mail): drop unused name argument to addBcc method - #142

Open
faisalahammad wants to merge 1 commit into
wpexpertsio:old/devfrom
faisalahammad:fix/104-addbcc-args
Open

fix(zend-mail): drop unused name argument to addBcc method#142
faisalahammad wants to merge 1 commit into
wpexpertsio:old/devfrom
faisalahammad:fix/104-addbcc-args

Conversation

@faisalahammad

Copy link
Copy Markdown

Summary

PostmanZendMailEngine passes $recipient->getName() as a second argument to Postman_Zend_Mail::addBcc(), but the vendor method signature only accepts $email. PHP 8 raises warnings for excess non-variadic arguments.

Fixes #104

Changes

Postman/Postman-Mail/PostmanZendMailEngine.php

Before:

$mail->addBcc( $recipient->getEmail(), $recipient->getName() );

After:

$mail->addBcc( $recipient->getEmail() );

Why: The Zend vendor addBcc() accepts only $email and internally passes `` for the name when calling _addRecipientAndHeader. The recipient name was already discarded in practice. Removing the second arg eliminate the PHP 8 warning without changing behavior.

Testing

Test 1: Syntax check

  1. Run php -l Postman/Postman-Mail/PostmanZendMailEngine.php
    Result: No syntax errors detected.

Test 2: PHP 8 warning regression (WP + PHP 8.1+)

  1. Configure a transport in Post SMTP settings
  2. Send a test email with Bcc recipients populated
  3. Check WP_DEBUG_LOG for any addBcc related warnings
    Result: No warnings logged.

Test 3: Bcc delivery

  1. Send a test email with Bcc recipients
  2. Verify the email is delivered to Bcc recipients
    Result: Delivery works (same behavior as PHP 7).

Test 4: Cc regression check

  1. Send a test email with Cc recipients
  2. Verify Cc display names appear in headers
    Result: Cc loop unchanged, names render correctly.

Vendor Zend_Zend_Mail::addBcc() signature accepts only ($email), so
PHP 8 warns on the two-argument call here. The vendor method internally
passes '' as the name anyway, so the recipient name was already lost.
Removing the second arg eliminates the warning without behavior change.

Fixes wpexpertsio#104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Too many arguments passed to Postman_Zend_Mail::addBcc()

1 participant