Skip to content

Fix bug where emojis in contrib title cause SQL error #390

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

Draft
wants to merge 3 commits into
base: 3.3.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions config/controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ services:
- '@phpbb.titania.attachment.uploader'
- '@phpbb.titania.attachment.uploader'
- '@phpbb.titania.subscriptions'
- '@text_formatter.parser'
- '@text_formatter.utils'

phpbb.titania.controller.contrib.revision:
class: phpbb\titania\controller\contribution\revision
Expand Down
19 changes: 18 additions & 1 deletion controller/contribution/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class manage extends base
/** @var \phpbb\titania\subscriptions */
protected $subscriptions;

/** @var \phpbb\textformatter\s9e\parser */
protected $parser;

/** @var \phpbb\textformatter\s9e\utils */
protected $utils;

/** @var bool */
protected $is_moderator;

Expand Down Expand Up @@ -68,15 +74,19 @@ class manage extends base
* @param \phpbb\titania\attachment\uploader $screenshots
* @param \phpbb\titania\attachment\uploader $colorizeit_sample
* @param \phpbb\titania\subscriptions $subscriptions
* @param \phpbb\textformatter\s9e\parser $parser
* @param \phpbb\textformatter\s9e\utils $utils
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions)
public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\template\template $template, \phpbb\user $user, \phpbb\titania\controller\helper $helper, type_collection $types, \phpbb\request\request $request, \phpbb\titania\cache\service $cache, \phpbb\titania\config\config $ext_config, \phpbb\titania\display $display, \phpbb\titania\access $access, \phpbb\titania\message\message $message, \phpbb\titania\attachment\uploader $screenshots, \phpbb\titania\attachment\uploader $colorizeit_sample, \phpbb\titania\subscriptions $subscriptions, \phpbb\textformatter\s9e\parser $parser, \phpbb\textformatter\s9e\utils $utils)
{
parent::__construct($auth, $config, $db, $template, $user, $helper, $types, $request, $cache, $ext_config, $display, $access);

$this->message = $message;
$this->screenshots = $screenshots;
$this->colorizeit_sample = $colorizeit_sample;
$this->subscriptions = $subscriptions;
$this->parser = $parser;
$this->utils = $utils;
}

/**
Expand Down Expand Up @@ -490,6 +500,9 @@ protected function submit($authors, $old_settings)
// Set custom field values.
$this->contrib->set_custom_fields($this->settings['custom']);

// Parse the contrib name so emojis can be used
$this->contrib->contrib_name = $this->parser->parse($this->contrib->contrib_name);

// Create relations
$this->contrib->put_contrib_in_categories(
$this->settings['categories'],
Expand Down Expand Up @@ -708,6 +721,10 @@ protected function assign_vars($error)
$this->contrib->type->id
);
}

// Unparse the contrib name
$this->contrib->contrib_name = $this->utils->unparse($this->contrib->contrib_name);

$this->message->display();
$this->contrib->assign_details();
$this->display->assign_global_vars();
Expand Down