Can't fix Email Error on Bounce Collection

Anthony Parsons

Well-known member
Affected version
2.0.7
Latest XF2, Dev mode on. Using gmail for bounce mail, SES for sending.

Code:
Server error log
ErrorException: Bounce message processing failed: [E_DEPRECATED] idn_to_utf8(): INTL_IDNA_VARIANT_2003 is deprecated src/vendor/zendframework/zend-validator/src/EmailAddress.php:545
Generated by: Unknown account Jul 20, 2018 at 4:55 PM
Stack trace
#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/home/nginx/dom...', 545, Array)
#1 src/vendor/zendframework/zend-validator/src/EmailAddress.php(545): idn_to_utf8('myptsd.com.boun...')
#2 src/vendor/zendframework/zend-validator/src/EmailAddress.php(494): Zend\Validator\EmailAddress->idnToUtf8('myptsd.com.boun...')
#3 src/vendor/zendframework/zend-mail/src/Address.php(39): Zend\Validator\EmailAddress->isValid('myptsd.com.boun...')
#4 src/vendor/zendframework/zend-mail/src/AddressList.php(249): Zend\Mail\Address->__construct('myptsd.com.boun...', NULL)
#5 src/vendor/zendframework/zend-mail/src/AddressList.php(35): Zend\Mail\AddressList->createAddress('myptsd.com.boun...', NULL)
#6 src/vendor/zendframework/zend-mail/src/AddressList.php(113): Zend\Mail\AddressList->add('myptsd.com.boun...', NULL)
#7 src/vendor/zendframework/zend-mail/src/Header/AbstractAddressList.php(71): Zend\Mail\AddressList->addFromString('myptsd.com.boun...')
#8 src/vendor/zendframework/zend-mail/src/Headers.php(478): Zend\Mail\Header\AbstractAddressList::fromString('To: myptsd.com....')
#9 src/vendor/zendframework/zend-mail/src/Headers.php(313): Zend\Mail\Headers->lazyLoadHeader(14)
#10 src/vendor/zendframework/zend-mail/src/Storage/Part.php(291): Zend\Mail\Headers->get('to')
#11 src/vendor/zendframework/zend-mail/src/Storage/Part.php(365): Zend\Mail\Storage\Part->getHeader('to', 'string')
#12 src/XF/EmailBounce/Parser.php(343): Zend\Mail\Storage\Part->__get('to')
#13 src/XF/EmailBounce/Parser.php(204): XF\EmailBounce\Parser->extractRecipient(Object(Zend\Mail\Storage\Message), Object(XF\EmailBounce\ParseResult))
#14 src/XF/EmailBounce/Processor.php(69): XF\EmailBounce\Parser->parseMessage(Object(Zend\Mail\Storage\Message))
#15 src/XF/EmailBounce/Processor.php(53): XF\EmailBounce\Processor->processMessage('Delivered-To: m...')
#16 src/XF/Job/EmailBounce.php(27): XF\EmailBounce\Processor->processFromStorage(Object(Zend\Mail\Storage\Imap), 7.8196928501129)
#17 src/XF/Job/Manager.php(241): XF\Job\EmailBounce->run(7.8196928501129)
#18 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.8196928501129)
#19 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.8196928501129)
#20 job.php(15): XF\Job\Manager->runQueue(false, 8)
#21 {main}
Request state
array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(25) "https://www.ptsdnews.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
The main problem here is you're running development mode which, in turn, enables debug mode. If this is a live site, it shouldn't be running, or it should only be enabled for specific IP addresses or even only for the CLI.

If development mode wasn't running then this deprecation notice wouldn't interrupt the process.

The problem lies with the paradox of trying to support a wide range of PHP versions. We can't support any component in Zend Framework higher than version 2.4.0 because that's when the PHP requirements change beyond PHP 5.4. They didn't add support for PHP 7.2 (which I believe you're running, based on the error) until ZF 2.9.x (I think).

This is fixed in XF 2.1 because we're bumping our minimum to PHP 5.6 which is fine for ZF 2.10.0 and above and therefore we can be surer of a breadth of PHP version support.

You may be able to work around the issue with something like this in src/config.php:
PHP:
error_reporting(error_reporting() & ~E_DEPRECATED);
This will keep the error reporting level the same, but remove the E_DEPRECATED level.
 
Top Bottom