Skip to content

Commit 8b15574

Browse files
committed
use Normalizer when creating databases
1 parent e515b50 commit 8b15574

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
This version of the PHP driver is compatible with PHP versions 7.4 and 8.0.
66
Older versions of PHP are not supported.
77

8+
It is recommended to install the `php-intl` module so the PHP driver can access
9+
the `Normalizer` class of that module. This is needed to create databases with
10+
the extended database naming convention that can be enabled in ArangoDB 3.9.
11+
812
This version of the PHP driver removes the following functionality, which was deprecated
913
in a previous release and is not available in ArangoDB 3.9 anymore:
1014

lib/ArangoDBClient/Database.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ class Database
5858
*/
5959
public static function create(Connection $connection, $name, array $options = [])
6060
{
61+
try {
62+
// NFC-normalize the database name, as this is required
63+
// by the server
64+
$name = \Normalizer::normalize($name, \Normalizer::FORM_C);
65+
} catch (\Exception $e) {
66+
// don't fail if Unicode normalization doesn't work.
67+
// probably it is not installed.
68+
}
6169
$payload = [
6270
self::ENTRY_DATABASE_NAME => $name,
6371
self::ENTRY_DATABASE_USERS => [

0 commit comments

Comments
 (0)