General: Continuing to work towards a passing PHP Compatibility scan.

- Add `phpcs:ignore` statements to compatibility checks in PHPMailer.
- Remove quotes around the assertion in an `assert()` call. This will trigger a deprecated notice under certain conditions on PHP 7.2.

Props jrf, desrosj.
See #49922, #48033.

git-svn-id: https://develop.svn.wordpress.org/trunk@48045 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2020-06-15 14:54:23 +00:00
parent d9c53241dc
commit 6d10290267
2 changed files with 5 additions and 2 deletions

View File

@ -853,7 +853,7 @@ class PHPMailer
private function mailPassthru($to, $subject, $body, $header, $params) private function mailPassthru($to, $subject, $body, $header, $params)
{ {
//Check overloading of mail function to avoid double-encoding //Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) { if (ini_get('mbstring.func_overload') & 1) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
$subject = $this->secureHeader($subject); $subject = $this->secureHeader($subject);
} else { } else {
$subject = $this->encodeHeader($this->secureHeader($subject)); $subject = $this->encodeHeader($this->secureHeader($subject));
@ -1401,10 +1401,13 @@ class PHPMailer
//Ignore IDE complaints about this line - method signature changed in PHP 5.4 //Ignore IDE complaints about this line - method signature changed in PHP 5.4
$errorcode = 0; $errorcode = 0;
if (defined('INTL_IDNA_VARIANT_UTS46')) { if (defined('INTL_IDNA_VARIANT_UTS46')) {
// phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
$punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46); $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
} elseif (defined('INTL_IDNA_VARIANT_2003')) { } elseif (defined('INTL_IDNA_VARIANT_2003')) {
// phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated
$punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_2003); $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_2003);
} else { } else {
// phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
$punycode = idn_to_ascii($domain, $errorcode); $punycode = idn_to_ascii($domain, $errorcode);
} }
if (false !== $punycode) { if (false !== $punycode) {

View File

@ -83,7 +83,7 @@ class Text_Diff_Engine_shell {
if ($from_line_no < $match[1] || $to_line_no < $match[4]) { if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
// copied lines // copied lines
assert('$match[1] - $from_line_no == $match[4] - $to_line_no'); assert($match[1] - $from_line_no == $match[4] - $to_line_no);
array_push($edits, array_push($edits,
new Text_Diff_Op_copy( new Text_Diff_Op_copy(
$this->_getLines($from_lines, $from_line_no, $match[1] - 1), $this->_getLines($from_lines, $from_line_no, $match[1] - 1),