diff --git a/composer.json b/composer.json index 71c11264f..722e4e5e5 100755 --- a/composer.json +++ b/composer.json @@ -33,9 +33,9 @@ "coverage": "./vendor/bin/coverage-check ./tmp/clover.xml 90" }, "require": { + "php": ">=8.3", "ext-pdo": "*", "ext-mbstring": "*", - "php": ">=8.3", "utopia-php/framework": "0.33.*", "utopia-php/cache": "0.11.*", "utopia-php/mongo": "0.3.*" @@ -58,8 +58,8 @@ }, "config": { "allow-plugins": { - "php-http/discovery": false, - "tbachert/spi": false + "php-http/discovery": true, + "tbachert/spi": true } } } diff --git a/composer.lock b/composer.lock index a73ee5ada..c1ce86a9b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f7eec4bad737b741ae97c81db0532d29", + "content-hash": "43c3ff88660f90baf3ddf7ec8bc5136d", "packages": [ { "name": "brick/math", @@ -149,16 +149,16 @@ }, { "name": "google/protobuf", - "version": "v4.29.2", + "version": "v4.29.3", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "79aa5014efeeec3d137df5cdb0ae2fc163953945" + "reference": "ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/79aa5014efeeec3d137df5cdb0ae2fc163953945", - "reference": "79aa5014efeeec3d137df5cdb0ae2fc163953945", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7", + "reference": "ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7", "shasum": "" }, "require": { @@ -187,9 +187,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.29.2" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.29.3" }, - "time": "2024-12-18T14:11:12+00:00" + "time": "2025-01-08T21:00:13+00:00" }, { "name": "jean85/pretty-package-versions", @@ -465,16 +465,16 @@ }, { "name": "open-telemetry/api", - "version": "1.1.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "04c85a1e41a3d59fa9bdc801a5de1df6624b95ed" + "reference": "351a30baa79699de3de3a814c8ccc7b52ccdfb1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/04c85a1e41a3d59fa9bdc801a5de1df6624b95ed", - "reference": "04c85a1e41a3d59fa9bdc801a5de1df6624b95ed", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/351a30baa79699de3de3a814c8ccc7b52ccdfb1d", + "reference": "351a30baa79699de3de3a814c8ccc7b52ccdfb1d", "shasum": "" }, "require": { @@ -531,7 +531,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-11-16T04:32:30+00:00" + "time": "2025-01-08T23:50:34+00:00" }, { "name": "open-telemetry/context", @@ -594,16 +594,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "9b6de12204f25f8ab9540b46d6e7b5151897ce18" + "reference": "243d9657c44a06f740cf384f486afe954c2b725f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/9b6de12204f25f8ab9540b46d6e7b5151897ce18", - "reference": "9b6de12204f25f8ab9540b46d6e7b5151897ce18", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/243d9657c44a06f740cf384f486afe954c2b725f", + "reference": "243d9657c44a06f740cf384f486afe954c2b725f", "shasum": "" }, "require": { @@ -654,7 +654,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-04-30T18:28:30+00:00" + "time": "2025-01-08T23:50:03+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -721,16 +721,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.1.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "fb0ff8d8279a3776bd604791e2531dd0cc147e8b" + "reference": "9a1c3b866239dbff291e5cc555bb7793eab08127" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/fb0ff8d8279a3776bd604791e2531dd0cc147e8b", - "reference": "fb0ff8d8279a3776bd604791e2531dd0cc147e8b", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/9a1c3b866239dbff291e5cc555bb7793eab08127", + "reference": "9a1c3b866239dbff291e5cc555bb7793eab08127", "shasum": "" }, "require": { @@ -807,7 +807,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-10-18T21:01:35+00:00" + "time": "2025-01-08T23:50:34+00:00" }, { "name": "open-telemetry/sem-conv", @@ -1408,12 +1408,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -1458,16 +1458,16 @@ }, { "name": "symfony/http-client", - "version": "v7.2.1", + "version": "v7.2.2", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "ff4df2b68d1c67abb9fef146e6540ea16b58d99e" + "reference": "339ba21476eb184290361542f732ad12c97591ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/ff4df2b68d1c67abb9fef146e6540ea16b58d99e", - "reference": "ff4df2b68d1c67abb9fef146e6540ea16b58d99e", + "url": "https://api.github.com/repos/symfony/http-client/zipball/339ba21476eb184290361542f732ad12c97591ec", + "reference": "339ba21476eb184290361542f732ad12c97591ec", "shasum": "" }, "require": { @@ -1533,7 +1533,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.2.1" + "source": "https://github.com/symfony/http-client/tree/v7.2.2" }, "funding": [ { @@ -1549,7 +1549,7 @@ "type": "tidelift" } ], - "time": "2024-12-07T08:50:44+00:00" + "time": "2024-12-30T18:35:15+00:00" }, { "name": "symfony/http-client-contracts", @@ -1889,12 +1889,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -2390,16 +2390,16 @@ }, { "name": "laravel/pint", - "version": "v1.18.3", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "cef51821608239040ab841ad6e1c6ae502ae3026" + "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/cef51821608239040ab841ad6e1c6ae502ae3026", - "reference": "cef51821608239040ab841ad6e1c6ae502ae3026", + "url": "https://api.github.com/repos/laravel/pint/zipball/8169513746e1bac70c85d6ea1524d9225d4886f0", + "reference": "8169513746e1bac70c85d6ea1524d9225d4886f0", "shasum": "" }, "require": { @@ -2410,10 +2410,10 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.65.0", - "illuminate/view": "^10.48.24", - "larastan/larastan": "^2.9.11", - "laravel-zero/framework": "^10.4.0", + "friendsofphp/php-cs-fixer": "^3.66.0", + "illuminate/view": "^10.48.25", + "larastan/larastan": "^2.9.12", + "laravel-zero/framework": "^10.48.25", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.17.0", "pestphp/pest": "^2.36.0" @@ -2452,7 +2452,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-11-26T15:34:00+00:00" + "time": "2024-12-30T16:20:10+00:00" }, { "name": "myclabs/deep-copy", @@ -2724,16 +2724,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.13", + "version": "1.12.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f" + "reference": "c91d4e8bc056f46cf653656e6f71004b254574d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b469068840cfa031e1deaf2fa1886d00e20680f", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c91d4e8bc056f46cf653656e6f71004b254574d1", + "reference": "c91d4e8bc056f46cf653656e6f71004b254574d1", "shasum": "" }, "require": { @@ -2778,7 +2778,7 @@ "type": "github" } ], - "time": "2024-12-17T17:00:20+00:00" + "time": "2025-01-05T16:40:22+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4349,14 +4349,14 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { + "php": ">=8.3", "ext-pdo": "*", - "ext-mbstring": "*", - "php": ">=8.3" + "ext-mbstring": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index e832776e4..f8c1cf60d 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -1654,8 +1654,8 @@ public function deleteDocument(string $collection, string $id): bool $name = $this->filter($collection); $sql = " - DELETE FROM {$this->getSQLTable($name)} - WHERE _uid = :_uid + DELETE FROM {$this->getSQLTable($name)} + WHERE _uid = :_uid "; if ($this->sharedTables) { @@ -2394,27 +2394,27 @@ protected function processException(PDOException $e): \Exception { // Timeout if ($e->getCode() === '70100' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1969) { - return new TimeoutException($e->getMessage(), $e->getCode(), $e); + return new TimeoutException('Query timed out', $e->getCode(), $e); } // Duplicate table if ($e->getCode() === '42S01' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1050) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Collection already exists', $e->getCode(), $e); } // Duplicate column if ($e->getCode() === '42S21' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1060) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Attribute already exists', $e->getCode(), $e); } // Duplicate index if ($e->getCode() === '42000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1061) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Index already exists', $e->getCode(), $e); } // Duplicate row if ($e->getCode() === '23000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1062) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Document already exists', $e->getCode(), $e); } // Data is too big for column resize @@ -2425,7 +2425,7 @@ protected function processException(PDOException $e): \Exception // Unknown database if ($e->getCode() === '42000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1049) { - return new NotFoundException($e->getMessage(), $e->getCode(), $e); + return new NotFoundException('Database not found', $e->getCode(), $e); } return $e; diff --git a/src/Database/Adapter/Mongo.php b/src/Database/Adapter/Mongo.php index bae6ca9db..7d6f7ddcb 100644 --- a/src/Database/Adapter/Mongo.php +++ b/src/Database/Adapter/Mongo.php @@ -1934,7 +1934,7 @@ public function getKeywords(): array protected function processException(Exception $e): \Exception { if ($e->getCode() === 50) { - return new Timeout($e->getMessage()); + return new Timeout('Query timed out', $e->getCode(), $e); } return $e; diff --git a/src/Database/Adapter/MySQL.php b/src/Database/Adapter/MySQL.php index fb1694cd0..60cd66ab9 100644 --- a/src/Database/Adapter/MySQL.php +++ b/src/Database/Adapter/MySQL.php @@ -84,12 +84,12 @@ protected function processException(PDOException $e): \Exception { // Timeout if ($e->getCode() === 'HY000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 3024) { - return new TimeoutException($e->getMessage(), $e->getCode(), $e); + return new TimeoutException('Query timed out', $e->getCode(), $e); } // Functional index dependency if ($e->getCode() === 'HY000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 3837) { - return new DependencyException($e->errorInfo[2], $e->getCode(), $e); + return new DependencyException('Attribute cannot be deleted because it is used in an index', $e->getCode(), $e); } return parent::processException($e); diff --git a/src/Database/Adapter/Postgres.php b/src/Database/Adapter/Postgres.php index c37c95e0f..9ca80f90c 100644 --- a/src/Database/Adapter/Postgres.php +++ b/src/Database/Adapter/Postgres.php @@ -2421,22 +2421,22 @@ protected function processException(PDOException $e): \Exception { // Timeout if ($e->getCode() === '57014' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 7) { - return new TimeoutException($e->getMessage(), $e->getCode(), $e); + return new TimeoutException('Query timed out', $e->getCode(), $e); } // Duplicate table if ($e->getCode() === '42P07' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 7) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Collection already exists', $e->getCode(), $e); } // Duplicate column if ($e->getCode() === '42701' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 7) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Attribute already exists', $e->getCode(), $e); } // Duplicate row if ($e->getCode() === '23505' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 7) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Document already exists', $e->getCode(), $e); } // Data is too big for column resize diff --git a/src/Database/Adapter/SQLite.php b/src/Database/Adapter/SQLite.php index 8442367ff..31bc38f38 100644 --- a/src/Database/Adapter/SQLite.php +++ b/src/Database/Adapter/SQLite.php @@ -1210,12 +1210,12 @@ protected function processException(PDOException $e): \Exception { // Timeout if ($e->getCode() === 'HY000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 3024) { - return new TimeoutException($e->getMessage(), $e->getCode(), $e); + return new TimeoutException('Query timed out', $e->getCode(), $e); } // Duplicate if ($e->getCode() === 'HY000' && isset($e->errorInfo[1]) && $e->errorInfo[1] === 1) { - return new DuplicateException($e->getMessage(), $e->getCode(), $e); + return new DuplicateException('Document already exists', $e->getCode(), $e); } return $e; diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index cde062f7e..cb16877e8 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1301,7 +1301,7 @@ public function testPurgeCollectionCache(): void $this->assertArrayHasKey('age', $document); } - public function testSchemaAttribute(): void + public function testSchemaAttributes(): void { if (!$this->getDatabase()->getAdapter()->getSupportForSchemaAttributes()) { $this->expectNotToPerformAssertions(); @@ -1358,9 +1358,9 @@ public function testSchemaAttribute(): void if ($db->getSharedTables()) { $attribute = $attributes['_tenant']; $this->assertEquals('_tenant', $attribute['columnName']); - $this->assertEquals('int', $attribute['dataType']); - $this->assertEquals('10', $attribute['numericPrecision']); - $this->assertTrue(in_array($attribute['columnType'], ['int unsigned', 'int(11) unsigned'])); + $this->assertEquals('bigint', $attribute['dataType']); + $this->assertEquals('20', $attribute['numericPrecision']); + $this->assertTrue(in_array($attribute['columnType'], ['bigint unsigned', 'bigint(20) unsigned'])); } } @@ -2910,7 +2910,7 @@ public function testArrayAttribute(): void $this->fail('Failed to throw exception'); } catch (Throwable $e) { $this->assertInstanceOf(DependencyException::class, $e); - $this->assertEquals("Column 'cards' has a functional index dependency and cannot be dropped or renamed.", $e->getMessage()); + $this->assertEquals('Attribute cannot be deleted because it is used in an index', $e->getMessage()); } try { @@ -2918,7 +2918,7 @@ public function testArrayAttribute(): void $this->fail('Failed to throw exception'); } catch (Throwable $e) { $this->assertInstanceOf(DependencyException::class, $e); - $this->assertEquals("Column 'cards' has a functional index dependency and cannot be dropped or renamed.", $e->getMessage()); + $this->assertEquals('Attribute cannot be deleted because it is used in an index', $e->getMessage()); } } else { $this->assertTrue($database->renameAttribute($collection, 'cards', 'cards_new'));