Merge pull request #1700 from candrews/patch-1

Call idn_to_ascii with INTL_IDNA_VARIANT_UTS46
This commit is contained in:
Alexandre Alapetite authored and GitHub committed 2017-12-02 14:10:09 +01:00
commit 7490dfdc42
2 files changed
+7 -1

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ People are sorted by name so please keep this order.
* [Amaury Carrade](https://github.com/AmauryCarrade): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=AmauryCarrade), [Web](https://amaury.carrade.eu/)
* [Anton Smirnov](https://github.com/sandfoxme): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:sandfoxme), [Web](http://sandfox.me/)
* [ASMfreaK](https://github.com/ASMfreaK): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ASMfreaK)
* [Craig Andrews](https://github.com/candrews): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:candrews), [Web](http://candrews.integralblue.com/)
* [Crupuk](https://github.com/Crupuk): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Crupuk)
* [Damstre](https://github.com/Damstre): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Damstre)
* [danc](https://github.com/danc): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=danc), [Web](http://tintouli.free.fr/)
+6 -1
View File
@@ -62,7 +62,12 @@ function idn_to_puny($url) {
$parts = parse_url($url);
if (!empty($parts['host'])) {
$idn = $parts['host'];
$puny = idn_to_ascii($idn);
// INTL_IDNA_VARIANT_UTS46 is defined starting in PHP 5.4
if (defined('INTL_IDNA_VARIANT_UTS46')) {
$puny = idn_to_ascii($idn, 0, INTL_IDNA_VARIANT_UTS46);
} else {
$puny = idn_to_ascii($idn);
}
$pos = strpos($url, $idn);
if ($pos !== false) {
return substr_replace($url, $puny, $pos, strlen($idn));