You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 6.4: (28 commits)
[Serializer] Fix `@method` annotation
fix compatibility with Doctrine DBAL 4
ensure string type with mbstring func overloading enabled
[HttpKernel] Fix quotes expectations in tests
[Validator] updated Greek translation
[Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL
[HttpClient][WebProfilerBundle] Do not generate cURL command when files are uploaded
render newline in front of all script elements
fix test fixture
fix tests
[Cache] Fix property types in PdoAdapter
PHP files cannot be executable without shebang
[TwigBridge] Mark CodeExtension as @internal
Remove full DSNs from exception messages
[Yaml] Fix uid binary parsing
Disable the "Copy as cURL" button when the debug info are disabled
[HttpClient] Replace `escapeshellarg` to prevent overpassing `ARG_MAX`
Fix missing `profile` option for console commands
[HttpFoundation][Lock] Makes MongoDB adapters usable with `ext-mongodb` only
[HttpKernel] Preventing error 500 when function putenv is disabled
...
class MongoDbStore implements PersistingStoreInterface
49
54
{
50
55
use ExpiringStoreTrait;
51
56
52
-
privateCollection$collection;
53
-
privateClient$client;
57
+
privateManager$manager;
58
+
privatestring$namespace;
54
59
privatestring$uri;
55
60
privatearray$options;
56
61
privatefloat$initialTtl;
57
62
58
63
/**
59
-
* @param Collection|Client|string $mongo An instance of a Collection or Client or URI @see https://docs.mongodb.com/manual/reference/connection-string/
60
-
* @param array $options See below
61
-
* @param float $initialTtl The expiration delay of locks in seconds
64
+
* @param Collection|Client|Manager|string $mongo An instance of a Collection or Client or URI @see https://docs.mongodb.com/manual/reference/connection-string/
65
+
* @param array $options See below
66
+
* @param float $initialTtl The expiration delay of locks in seconds
62
67
*
63
68
* @throws InvalidArgumentException If required options are not provided
64
69
* @throws InvalidTtlException When the initial ttl is not valid
@@ -88,7 +93,7 @@ class MongoDbStore implements PersistingStoreInterface
if ($this->options['gcProbability'] < 0.0 || $this->options['gcProbability'] > 1.0) {
121
132
thrownewInvalidArgumentException(sprintf('"%s()" gcProbability must be a float from 0.0 to 1.0, "%f" given.', __METHOD__, $this->options['gcProbability']));
@@ -135,6 +146,10 @@ public function __construct(Collection|Client|string $mongo, array $options = []
135
146
*/
136
147
privatefunctionskimUri(string$uri): string
137
148
{
149
+
if (!str_starts_with($uri, 'mongodb://') && !str_starts_with($uri, 'mongodb+srv://')) {
150
+
thrownewInvalidArgumentException(sprintf('The given MongoDB Connection URI "%s" is invalid. Expecting "mongodb://" or "mongodb+srv://".', $uri));
151
+
}
152
+
138
153
if (false === $parsedUrl = parse_url($uri)) {
139
154
thrownewInvalidArgumentException(sprintf('The given MongoDB Connection URI "%s" is invalid.', $uri));
140
155
}
@@ -186,14 +201,19 @@ private function skimUri(string $uri): string
0 commit comments