diff --git a/composer.lock b/composer.lock index fa94a2fb54..ed4c86cfe7 100644 --- a/composer.lock +++ b/composer.lock @@ -3167,7 +3167,7 @@ }, { "name": "utopia-php/audit", - "version": "2.9.0", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", @@ -3206,7 +3206,7 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/2.9.0" + "source": "https://github.com/utopia-php/audit/tree/2.9.1" }, "time": "2026-07-15T10:27:51+00:00" }, @@ -3635,16 +3635,16 @@ }, { "name": "utopia-php/database", - "version": "6.4.4", + "version": "6.5.1", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "a1796fd360d58abcc3bb3e1b615fcebc04ba9100" + "reference": "7fd133e99698feb300a689be8767efa975c2cf13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/a1796fd360d58abcc3bb3e1b615fcebc04ba9100", - "reference": "a1796fd360d58abcc3bb3e1b615fcebc04ba9100", + "url": "https://api.github.com/repos/utopia-php/database/zipball/7fd133e99698feb300a689be8767efa975c2cf13", + "reference": "7fd133e99698feb300a689be8767efa975c2cf13", "shasum": "" }, "require": { @@ -3689,9 +3689,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/6.4.4" + "source": "https://github.com/utopia-php/database/tree/6.5.1" }, - "time": "2026-07-17T08:21:36+00:00" + "time": "2026-07-27T09:40:21+00:00" }, { "name": "utopia-php/detector", @@ -4055,16 +4055,16 @@ }, { "name": "utopia-php/http", - "version": "2.0.0-rc18", + "version": "2.0.0-rc19", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "3bfc500c6a53ffb87d4dcb95b4712b6a91b24439" + "reference": "7a9419858c6c612a8d783024ad46740f857e4430" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/3bfc500c6a53ffb87d4dcb95b4712b6a91b24439", - "reference": "3bfc500c6a53ffb87d4dcb95b4712b6a91b24439", + "url": "https://api.github.com/repos/utopia-php/http/zipball/7a9419858c6c612a8d783024ad46740f857e4430", + "reference": "7a9419858c6c612a8d783024ad46740f857e4430", "shasum": "" }, "require": { @@ -4102,22 +4102,22 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/2.0.0-rc18" + "source": "https://github.com/utopia-php/http/tree/2.0.0-rc19" }, - "time": "2026-07-13T16:18:22+00:00" + "time": "2026-07-27T07:23:46+00:00" }, { "name": "utopia-php/image", - "version": "0.8.7", + "version": "0.8.9", "source": { "type": "git", "url": "https://github.com/utopia-php/image.git", - "reference": "ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7" + "reference": "6647714267e43bae25c8e8ae7021264eca4a1e84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/image/zipball/ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7", - "reference": "ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7", + "url": "https://api.github.com/repos/utopia-php/image/zipball/6647714267e43bae25c8e8ae7021264eca4a1e84", + "reference": "6647714267e43bae25c8e8ae7021264eca4a1e84", "shasum": "" }, "require": { @@ -4125,11 +4125,6 @@ "ext-imagick": "*", "php": ">=8.1" }, - "require-dev": { - "laravel/pint": "1.24.*", - "phpstan/phpstan": "2.1.*", - "phpunit/phpunit": "10.5.*" - }, "suggest": { "ext-imagick": "Imagick extension is required for Imagick adapter" }, @@ -4153,9 +4148,9 @@ ], "support": { "issues": "https://github.com/utopia-php/image/issues", - "source": "https://github.com/utopia-php/image/tree/0.8.7" + "source": "https://github.com/utopia-php/image/tree/0.8.9" }, - "time": "2026-07-13T12:12:06+00:00" + "time": "2026-07-20T18:04:09+00:00" }, { "name": "utopia-php/locale", @@ -5421,31 +5416,31 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "2.4.13", + "version": "2.4.19", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "7ead3b6ff1746ae950cacca55bc9800708d5beff" + "reference": "d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7ead3b6ff1746ae950cacca55bc9800708d5beff", - "reference": "7ead3b6ff1746ae950cacca55bc9800708d5beff", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9", + "reference": "d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "matthiasmullie/minify": "1.3.*", + "matthiasmullie/minify": "^1.3", "php": ">=8.5", - "twig/twig": "3.28.*" + "twig/twig": "^3.28" }, "require-dev": { - "brianium/paratest": "7.*", - "phpunit/phpunit": "11.*", + "brianium/paratest": "^7", + "phpunit/phpunit": "^11", "rector/rector": "^2.4", - "squizlabs/php_codesniffer": "4.*" + "squizlabs/php_codesniffer": "^4" }, "type": "library", "autoload": { @@ -5467,9 +5462,9 @@ "description": "SDK generator for Appwrite APIs across multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/2.4.13" + "source": "https://github.com/appwrite/sdk-generator/tree/2.4.19" }, - "time": "2026-07-13T07:30:15+00:00" + "time": "2026-07-24T06:18:23+00:00" }, { "name": "brianium/paratest", @@ -6177,11 +6172,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.5", + "version": "2.2.6", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/909c1e5fef7989ac0d0c1c5c42e32a5c4f6198a0", - "reference": "909c1e5fef7989ac0d0c1c5c42e32a5c4f6198a0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a6e9b5a9420f6109c091e87d82683bd1a80b87ed", + "reference": "a6e9b5a9420f6109c091e87d82683bd1a80b87ed", "shasum": "" }, "require": { @@ -6237,7 +6232,7 @@ "type": "github" } ], - "time": "2026-07-05T06:31:06+00:00" + "time": "2026-07-26T21:22:49+00:00" }, { "name": "phpunit/php-code-coverage", @@ -6586,16 +6581,16 @@ }, { "name": "phpunit/phpunit", - "version": "12.5.31", + "version": "12.5.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0608d157a284f15cc73b99a3327eff06b66a176d" + "reference": "c02591dd7840ed124a98d7770753329ad28e9f8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d", - "reference": "0608d157a284f15cc73b99a3327eff06b66a176d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c02591dd7840ed124a98d7770753329ad28e9f8f", + "reference": "c02591dd7840ed124a98d7770753329ad28e9f8f", "shasum": "" }, "require": { @@ -6664,7 +6659,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.31" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.32" }, "funding": [ { @@ -6672,25 +6667,25 @@ "type": "other" } ], - "time": "2026-07-06T14:54:16+00:00" + "time": "2026-07-25T06:54:13+00:00" }, { "name": "rector/rector", - "version": "2.5.7", + "version": "2.5.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ba22f8c087848278fed6b4910d4cf1108096d8d3" + "reference": "861c77fd2a6d45317a401f4e0b617f947e8b6f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ba22f8c087848278fed6b4910d4cf1108096d8d3", - "reference": "ba22f8c087848278fed6b4910d4cf1108096d8d3", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/861c77fd2a6d45317a401f4e0b617f947e8b6f96", + "reference": "861c77fd2a6d45317a401f4e0b617f947e8b6f96", "shasum": "" }, "require": { "php": "^7.4|^8.0", - "phpstan/phpstan": "^2.2.2" + "phpstan/phpstan": "^2.2.6" }, "conflict": { "rector/rector-doctrine": "*", @@ -6724,7 +6719,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.5.7" + "source": "https://github.com/rectorphp/rector/tree/2.5.8" }, "funding": [ { @@ -6732,7 +6727,7 @@ "type": "github" } ], - "time": "2026-07-13T15:24:18+00:00" + "time": "2026-07-27T06:19:16+00:00" }, { "name": "sebastian/cli-parser", @@ -7697,16 +7692,16 @@ }, { "name": "swoole/ide-helper", - "version": "6.0.2", + "version": "6.2.2", "source": { "type": "git", "url": "https://github.com/swoole/ide-helper.git", - "reference": "6f12243dce071714c5febe059578d909698f9a52" + "reference": "ad91a281e135f498426fb2e5297376581a4e2dca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swoole/ide-helper/zipball/6f12243dce071714c5febe059578d909698f9a52", - "reference": "6f12243dce071714c5febe059578d909698f9a52", + "url": "https://api.github.com/repos/swoole/ide-helper/zipball/ad91a281e135f498426fb2e5297376581a4e2dca", + "reference": "ad91a281e135f498426fb2e5297376581a4e2dca", "shasum": "" }, "type": "library", @@ -7723,9 +7718,9 @@ "description": "IDE help files for Swoole.", "support": { "issues": "https://github.com/swoole/ide-helper/issues", - "source": "https://github.com/swoole/ide-helper/tree/6.0.2" + "source": "https://github.com/swoole/ide-helper/tree/6.2.2" }, - "time": "2025-03-23T07:31:41+00:00" + "time": "2026-07-25T08:15:29+00:00" }, { "name": "symfony/console", @@ -8438,5 +8433,5 @@ "platform-dev": { "ext-fileinfo": "*" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 4beed77479..1b5d0c4d73 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -3732,6 +3732,76 @@ trait DatabasesBase } } + public function testGetDocumentCacheEmpty(): void + { + $databaseId = $this->setupDatabase()['databaseId']; + + // Dedicated collection so the inserted document cannot change the + // document counts asserted by the shared movies-collection tests. + $collection = $this->client->call(Client::METHOD_POST, $this->getContainerUrl($databaseId), [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + $this->getContainerIdParam() => ID::unique(), + 'name' => 'CacheEmpty', + $this->getSecurityParam() => true, + 'permissions' => [ + Permission::create(Role::user($this->getUser()['$id'])), + ], + ]); + + $this->assertEquals(201, $collection['headers']['status-code']); + $containerId = $collection['body']['$id']; + + if ($this->getSupportForAttributes()) { + $this->createAttribute($databaseId, $containerId, 'string', [ + 'key' => 'title', + 'size' => 256, + 'required' => false, + ]); + $this->waitForAttribute($databaseId, $containerId, 'title'); + } + + $documentId = ID::unique(); + + // Read a document that does not exist yet -> negatively caches the miss. + $missing = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($databaseId, $containerId, $documentId), array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(404, $missing['headers']['status-code']); + + // Create that same id. This must purge the cached "not found". + $created = $this->client->call(Client::METHOD_POST, $this->getRecordUrl($databaseId, $containerId), array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + $this->getRecordIdParam() => $documentId, + 'data' => [ + 'title' => 'Cached Empty', + ], + 'permissions' => [ + Permission::read(Role::user($this->getUser()['$id'])), + ], + ]); + + $this->assertEquals(201, $created['headers']['status-code']); + $this->assertEquals($documentId, $created['body']['$id']); + + // The freshly created document must be visible right away. Without cache + // invalidation on create this would still return 404 from the marker. + $fetched = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($databaseId, $containerId, $documentId), array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $fetched['headers']['status-code']); + $this->assertEquals($documentId, $fetched['body']['$id']); + $this->assertEquals('Cached Empty', $fetched['body']['title']); + } + public function testGetDocumentWithQueries(): void { $data = $this->getDocumentsList();