-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback mechanism for missing IDN functions #14077
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ Requirements | |
* Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst | ||
* PHP 7.4+ | ||
* PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei | ||
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar and OpenSSL-Erweiterung | ||
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar, IDN und OpenSSL-Erweiterung | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hier sollte stattdessen |
||
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert) | ||
* Einen E-Mail Server, so dass PHP `mail()` funktioniert. | ||
Wenn kein eigener E-Mail Server zur Verfügung steht, kann alternativ das [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) Addon mit einem externen SMTP Account verwendet werden. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,6 +495,13 @@ public function checkFunctions() | |
); | ||
$returnVal = $returnVal ? $status : false; | ||
|
||
$status = $this->checkFunction('idn_to_ascii', | ||
DI::l10n()->t('IDN Functions PHP module'), | ||
DI::l10n()->t('Error: IDN Functions PHP module required but not installed.'), | ||
Comment on lines
+499
to
+500
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
true | ||
); | ||
$returnVal = $returnVal ? $status : false; | ||
|
||
return $returnVal; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -533,20 +533,29 @@ | |
{ | ||
$parts = parse_url($uri); | ||
if (!empty($parts['scheme']) && !empty($parts['host'])) { | ||
$parts['host'] = idn_to_ascii($parts['host']); | ||
$parts['host'] = self::idnToAscii($parts['host']); | ||
$uri = (string)Uri::fromParts($parts); | ||
} else { | ||
$parts = explode('@', $uri); | ||
if (count($parts) == 2) { | ||
$uri = $parts[0] . '@' . idn_to_ascii($parts[1]); | ||
$uri = $parts[0] . '@' . self::idnToAscii($parts[1]); | ||
} else { | ||
$uri = idn_to_ascii($uri); | ||
$uri = self::idnToAscii($uri); | ||
} | ||
} | ||
|
||
return $uri; | ||
} | ||
|
||
private static function idnToAscii(string $uri): string | ||
{ | ||
if (!function_exists('idn_to_ascii')) { | ||
Logger::error('IDN functions are missing.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return $uri; | ||
} | ||
return idn_to_ascii($uri); | ||
} | ||
|
||
/** | ||
* Switch the scheme of an url between http and https | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should read
intl
instead.