From d0fb9f28bc16a61d6fe90b08c6484d4a5ce88e57 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 14 Jun 2015 20:44:18 +0200 Subject: [PATCH 1/4] Update input.php --- libraries/joomla/filter/input.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/joomla/filter/input.php b/libraries/joomla/filter/input.php index c9fca305e9129..02bb2f5e79c68 100644 --- a/libraries/joomla/filter/input.php +++ b/libraries/joomla/filter/input.php @@ -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; } @@ -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 From 0b7a2c7dff0ffcba81ed51d80be23f21c19028ce Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 14 Jun 2015 20:54:25 +0200 Subject: [PATCH 2/4] Update driver.php ``` FILE: ...ome/travis/build/joomla/joomla-cms/libraries/joomla/database/driver.php -------------------------------------------------------------------------------- FOUND 4 ERROR(S) AFFECTING 4 LINE(S) -------------------------------------------------------------------------------- 738 | ERROR | Concat operator must be followed by one space 774 | ERROR | Cast statements must be followed by a single space; expected | | "(object) $column" but found "(object)$column" 1085 | ERROR | Return comment requires a blank newline after it 1105 | ERROR | Return comment requires a blank newline after it -------------------------------------------------------------------------------- UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY -------------------------------------------------------------------------------- ``` --- libraries/joomla/database/driver.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/joomla/database/driver.php b/libraries/joomla/database/driver.php index cb423350385d3..cee812518573c 100644 --- a/libraries/joomla/database/driver.php +++ b/libraries/joomla/database/driver.php @@ -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 . '`'; } /** @@ -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)) { @@ -1077,6 +1077,7 @@ public function getImporter() * class name. * * @return string + * * @since CMS 3.5.0 */ public function getName() @@ -1097,6 +1098,7 @@ public function getName() * be returned instead. * * @return string + * * @since CMS 3.5.0 */ public function getServerType() From b793b7897885b7b3ad4a75dc9b6edf9551979092 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 14 Jun 2015 20:55:10 +0200 Subject: [PATCH 3/4] Update mysqli.php ``` FILE: ...vis/build/joomla/joomla-cms/libraries/joomla/database/driver/mysqli.php -------------------------------------------------------------------------------- FOUND 1 ERROR(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 941 | ERROR | Return comment requires a blank newline after it -------------------------------------------------------------------------------- UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY -------------------------------------------------------------------------------- ``` --- libraries/joomla/database/driver/mysqli.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/joomla/database/driver/mysqli.php b/libraries/joomla/database/driver/mysqli.php index b05f49f5a1307..9faaa4a18a329 100644 --- a/libraries/joomla/database/driver/mysqli.php +++ b/libraries/joomla/database/driver/mysqli.php @@ -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() From 374927cdcfd4e2aa0b03b0fcd34a866b8973e2d1 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 14 Jun 2015 20:56:13 +0200 Subject: [PATCH 4/4] Update mysql.php ``` FILE: ...avis/build/joomla/joomla-cms/libraries/joomla/database/driver/mysql.php -------------------------------------------------------------------------------- FOUND 1 ERROR(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 500 | ERROR | Return comment requires a blank newline after it -------------------------------------------------------------------------------- UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY -------------------------------------------------------------------------------- ``` --- libraries/joomla/database/driver/mysql.php | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/joomla/database/driver/mysql.php b/libraries/joomla/database/driver/mysql.php index 467f2db03ce90..13c259acb53ba 100644 --- a/libraries/joomla/database/driver/mysql.php +++ b/libraries/joomla/database/driver/mysql.php @@ -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()