Skip to content

Commit

Permalink
Merge pull request #9 from zero-24/patch-1
Browse files Browse the repository at this point in the history
Fix Travis Codestyle with CMS: #7173
  • Loading branch information
Nicholas K. Dionysopoulos committed Jun 14, 2015
2 parents e3a2a93 + 374927c commit 0317281
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions libraries/joomla/database/driver.php
Expand Up @@ -729,7 +729,7 @@ protected function getAlterDbCharacterSet($dbName)
{
$charset = $this->utf8mb4 ? 'utf8mb4' : 'utf8';

return 'ALTER DATABASE ' . $this->quoteName($dbName) . ' CHARACTER SET `' . $charset .'`';
return 'ALTER DATABASE ' . $this->quoteName($dbName) . ' CHARACTER SET `' . $charset . '`';
}

/**
Expand Down Expand Up @@ -765,7 +765,7 @@ public function getAlterTableCharacterSet($tableName)
foreach ($columns as $column)
{
// Make sure we are redefining only columns which do support a collation
$col = (object)$column;
$col = (object) $column;

if (empty($col->Collation))
{
Expand Down Expand Up @@ -1077,6 +1077,7 @@ public function getImporter()
* class name.
*
* @return string
*
* @since CMS 3.5.0
*/
public function getName()
Expand All @@ -1097,6 +1098,7 @@ public function getName()
* be returned instead.
*
* @return string
*
* @since CMS 3.5.0
*/
public function getServerType()
Expand Down
1 change: 1 addition & 0 deletions libraries/joomla/database/driver/mysql.php
Expand Up @@ -498,6 +498,7 @@ private function hasProfiling()
* libmysql supports utf8mb4 since 5.5.3 (same version as the MySQL server). mysqlnd supports utf8mb4 since 5.0.9.
*
* @return boolean
*
* @since CMS 3.5.0
*/
private function serverClaimsUtf8mb4Support()
Expand Down
1 change: 1 addition & 0 deletions libraries/joomla/database/driver/mysqli.php
Expand Up @@ -939,6 +939,7 @@ private function hasProfiling()
* libmysql supports utf8mb4 since 5.5.3 (same version as the MySQL server). mysqlnd supports utf8mb4 since 5.0.9.
*
* @return boolean
*
* @since CMS 3.5.0
*/
private function serverClaimsUtf8mb4Support()
Expand Down
4 changes: 3 additions & 1 deletion libraries/joomla/filter/input.php
Expand Up @@ -156,8 +156,10 @@ public function __construct($tagsArray = array(), $attrArray = array(), $tagsMet
{
// Get the database driver
$db = JFactory::getDbo();

// This trick is required to let the driver determine the utf-8 multibyte support
$db->connect();

// And now we can decide if we should strip USCs
$this->stripUSC = $db->hasUTF8mb4Support() ? 0 : 1;
}
Expand Down Expand Up @@ -228,8 +230,8 @@ public function clean($source, $type = 'string')
// Strip Unicode Supplementary Characters when requested to do so
if ($this->stripUSC)
{
$source = preg_replace('/[\xF0-\xF7].../s', "\xE2\xAF\x91", $source);
// Alternatively: preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xE2\xAF\x91", $source) but it'd be slower.
$source = preg_replace('/[\xF0-\xF7].../s', "\xE2\xAF\x91", $source);
}

// Handle the type constraint
Expand Down

0 comments on commit 0317281

Please sign in to comment.