From 9b5eb8fd8f405e5a51b55d6bb5553f2263b1f974 Mon Sep 17 00:00:00 2001 From: Darien Date: Fri, 20 Mar 2015 16:55:14 -0700 Subject: [PATCH 1/8] Change MySQL UTF-8 examples to use utf8mb4, which is closer to the standard most people would expect --- book/doctrine.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 7c69e801cca..362b67051ee 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -134,6 +134,12 @@ for you: There's no way to configure these defaults inside Doctrine, as it tries to be as agnostic as possible in terms of environment configuration. One way to solve this problem is to configure server-level defaults. + +.. caution:: + + If you are using MySQL, its `utf8` character set has some shortcomings + which may cause problems. Prefer the `utf8mb4` character set instead, if + your version supports it. Setting UTF8 defaults for MySQL is as simple as adding a few lines to your configuration file (typically ``my.cnf``): @@ -141,8 +147,8 @@ for you: .. code-block:: ini [mysqld] - collation-server = utf8_general_ci - character-set-server = utf8 + collation-server = utf8mb4_general_ci + character-set-server = utf8mb4 .. note:: From cbb500d64bb0dfe65f03ccba23c7cfe57a24a293 Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Mon, 23 Mar 2015 19:55:34 -0700 Subject: [PATCH 2/8] Fix example name to avoid breaking collision with standard data-collectors --- cookbook/profiler/data_collector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index db3a86bfdab..5ecb546185a 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -67,7 +67,7 @@ populate the ``$this->data`` property (it takes care of serializing the public function getName() { - return 'memory'; + return 'example_memory'; } } From 62acae4ac2f5c309a56749aa9d4c0cd7979efc52 Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Mon, 23 Mar 2015 19:58:18 -0700 Subject: [PATCH 3/8] Add a cautionary note telling users where the "standard" data-collector names can be found. --- cookbook/profiler/data_collector.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index 5ecb546185a..50eef5e42a1 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -70,6 +70,12 @@ populate the ``$this->data`` property (it takes care of serializing the return 'example_memory'; } } + +.. caution:: + + The string you use with `getName()` should not collide with standard data- + collectors, such as those within the + `Symfony\Component\HttpKernel\DataCollector\` package. .. _data_collector_tag: From a0947401782e3bc62dddf521c740b1913a2e1187 Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Tue, 24 Mar 2015 09:54:46 -0700 Subject: [PATCH 4/8] Revert "Add a cautionary note telling users where the "standard" data-collector names can be found." This reverts commit 62acae4ac2f5c309a56749aa9d4c0cd7979efc52. --- cookbook/profiler/data_collector.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index 50eef5e42a1..5ecb546185a 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -70,12 +70,6 @@ populate the ``$this->data`` property (it takes care of serializing the return 'example_memory'; } } - -.. caution:: - - The string you use with `getName()` should not collide with standard data- - collectors, such as those within the - `Symfony\Component\HttpKernel\DataCollector\` package. .. _data_collector_tag: From cdd1d2f54951aabee2d4139761c58913ba501bff Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Wed, 25 Mar 2015 13:41:47 -0700 Subject: [PATCH 5/8] Revert "Fix example name to avoid breaking collision with standard data-collectors" This reverts commit cbb500d64bb0dfe65f03ccba23c7cfe57a24a293. --- cookbook/profiler/data_collector.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index 5ecb546185a..db3a86bfdab 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -67,7 +67,7 @@ populate the ``$this->data`` property (it takes care of serializing the public function getName() { - return 'example_memory'; + return 'memory'; } } From 4ae1446354738a19c0cf2f3ea486ac5b3074c0f1 Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Wed, 25 Mar 2015 13:48:18 -0700 Subject: [PATCH 6/8] Indenting caution block to nest it inside the sidebar --- book/doctrine.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 362b67051ee..588c0d7a155 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -135,11 +135,11 @@ for you: as agnostic as possible in terms of environment configuration. One way to solve this problem is to configure server-level defaults. -.. caution:: + .. caution:: - If you are using MySQL, its `utf8` character set has some shortcomings - which may cause problems. Prefer the `utf8mb4` character set instead, if - your version supports it. + If you are using MySQL, its `utf8` character set actually only supports + a portion of valid UTF-8 data that you may encounter. Instead, try to + use the newer `utf8mb4` if your system supports it. Setting UTF8 defaults for MySQL is as simple as adding a few lines to your configuration file (typically ``my.cnf``): From 44a03ebf8f46f5c12689682e33167528519ef32b Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Thu, 26 Mar 2015 13:02:11 -0700 Subject: [PATCH 7/8] Add backticks for code-styling --- book/doctrine.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 588c0d7a155..0c2cd6134db 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -137,9 +137,9 @@ for you: .. caution:: - If you are using MySQL, its `utf8` character set actually only supports + If you are using MySQL, its ``utf8`` character set actually only supports a portion of valid UTF-8 data that you may encounter. Instead, try to - use the newer `utf8mb4` if your system supports it. + use the newer ``utf8mb4`` if your system supports it. Setting UTF8 defaults for MySQL is as simple as adding a few lines to your configuration file (typically ``my.cnf``): From 6206f235696038cafe4a51f674b00bd3949f6498 Mon Sep 17 00:00:00 2001 From: Darien Hager Date: Wed, 29 Apr 2015 11:27:52 -0700 Subject: [PATCH 8/8] Rewrite utf8mb4 cautions, add comment into sample configuration --- book/doctrine.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 0c2cd6134db..d598c4d60c5 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -134,12 +134,6 @@ for you: There's no way to configure these defaults inside Doctrine, as it tries to be as agnostic as possible in terms of environment configuration. One way to solve this problem is to configure server-level defaults. - - .. caution:: - - If you are using MySQL, its ``utf8`` character set actually only supports - a portion of valid UTF-8 data that you may encounter. Instead, try to - use the newer ``utf8mb4`` if your system supports it. Setting UTF8 defaults for MySQL is as simple as adding a few lines to your configuration file (typically ``my.cnf``): @@ -147,8 +141,13 @@ for you: .. code-block:: ini [mysqld] - collation-server = utf8mb4_general_ci - character-set-server = utf8mb4 + # Version 5.5.3 introduced "utf8mb4", which is recommended + collation-server = utf8mb4_general_ci # Replaces utf8_general_ci + character-set-server = utf8mb4 # Replaces utf8 + + We recommend against MySQL's ``utf8`` character set, since it does not + support 4-byte unicode characters, and strings containing them will be + truncated. This is fixed by the `newer utf8mb4 character set`_. .. note:: @@ -1425,3 +1424,4 @@ For more information about Doctrine, see the *Doctrine* section of the .. _`migrations`: http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html .. _`DoctrineFixturesBundle`: http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html .. _`FrameworkExtraBundle documentation`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html +.. _`newer utf8mb4 character set`: https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html