Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions includes/objects/contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,13 @@ public function set_demo_url($branch, $url)
*/
public function submit()
{
// Emojis and other four byte characters are not allowed by MySQL in the
// utf8 column the name is stored in, so replace them with their numeric
// character reference, as core does for report text. Doing it here keeps
// the encoded form out of everything that reads the name, including the
// release topic subject and the generated slug.
$this->contrib_name = utf8_encode_ucr($this->contrib_name);

if (!$this->contrib_id)
{
// Make sure the author exists, if not we create one (do this before returning if not approved...else we need to duplicate this code in a bunch of places)
Expand Down
7 changes: 7 additions & 0 deletions url/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ public function remove_nth_param($nth)
*/
public static function generate_slug($string)
{
// Neither a character reference nor a character outside the basic
// multilingual plane belongs in a slug: the columns slugs are stored in
// are utf8, which cannot hold the latter, and the digits of the former
// would end up in the URL.
$string = preg_replace('/&#[0-9]+;/', '', $string);
$string = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $string);

$string = self::url_replace($string, false);

// Replace any number of spaces with a single underscore
Expand Down