Skip to content

Commit

Permalink
MDL-63967 libs: some filter_var() filters are deprecated with php73
Browse files Browse the repository at this point in the history
The explicit usage of the constants FILTER_FLAG_SCHEME_REQUIRED and
FILTER_FLAG_HOST_REQUIRED is now deprecated; both are implied for
FILTER_VALIDATE_URL anyway.
  • Loading branch information
stronk7 committed Feb 1, 2019
1 parent a62e275 commit b762ed9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/phpmailer/README_MOODLE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ UPGRADING.md
composer.json
get_oauth_token.php
phpdoc.dist.xml
travis.phpunit.xml.dist
travis.phpunit.xml.dist

Local changes (to verify/apply with new imports):

- MDL-63967: PHP 7.3 compatibility.
lib/phpmailer/src/PHPMailer.php: FILTER_FLAG_HOST_REQUIRED is deprecated and
implied with FILTER_VALIDATE_URL. This was fixed upstream by
https://github.com/PHPMailer/PHPMailer/pull/1551
2 changes: 1 addition & 1 deletion lib/phpmailer/src/PHPMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3578,7 +3578,7 @@ public static function isValidHost($host)
//Is it a valid IPv4 address?
return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
if (filter_var('http://' . $host, FILTER_VALIDATE_URL)) {
//Is it a syntactically valid hostname?
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/typo3/class.t3lib_div.php
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ public static function isValidUrl($url) {
require_once(PATH_typo3 . 'contrib/idna/idna_convert.class.php');
$IDN = new idna_convert(array('idn_version' => 2008));

return (filter_var($IDN->encode($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== FALSE);
return (filter_var($IDN->encode($url), FILTER_VALIDATE_URL) !== FALSE);
}


Expand Down
7 changes: 7 additions & 0 deletions lib/typo3/readme_moodle.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ Procedure:
2/ copy csconvtbl/*, unidata/* and all other necessary files we use
3/ run our phpunit tests with and without mbstring PHP extension

Local changes (to verify/apply with new imports):

- MDL-63967: PHP 7.3 compatibility.
lib/typo3/class.t3lib_div.php: FILTER_FLAG_SCHEME_REQUIRED is deprecated and
implied with FILTER_VALIDATE_URL. This is fixed upstream since Typo 6, with
the file class now under \TYPO3\CMS\Core\Utility\GeneralUtility.

skodak, stronk7, moodler

0 comments on commit b762ed9

Please sign in to comment.