From 447b47592c22ac8dfe17954dd79eb26f759b9b0d Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 13 Dec 2021 13:42:40 +0100 Subject: [PATCH 01/13] Updated docs --- docs/references/account/update-prefs.md | 2 +- docs/references/users/update-user-prefs.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/references/account/update-prefs.md b/docs/references/account/update-prefs.md index cdfbdf9f0..8283f2f7c 100644 --- a/docs/references/account/update-prefs.md +++ b/docs/references/account/update-prefs.md @@ -1 +1 @@ -Update currently logged in user account preferences. You can pass only the specific settings you wish to update. \ No newline at end of file +Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. \ No newline at end of file diff --git a/docs/references/users/update-user-prefs.md b/docs/references/users/update-user-prefs.md index cb06d4a7f..392736367 100644 --- a/docs/references/users/update-user-prefs.md +++ b/docs/references/users/update-user-prefs.md @@ -1 +1 @@ -Update the user preferences by its unique ID. You can pass only the specific settings you wish to update. \ No newline at end of file +Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. \ No newline at end of file From 72625158422f0eeda9f8939c351d3fc0787a7be9 Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 13 Dec 2021 13:53:30 +0100 Subject: [PATCH 02/13] Added prefs max size limit --- app/controllers/api/account.php | 4 ++++ app/controllers/api/users.php | 4 ++++ docs/references/account/update-prefs.md | 2 +- docs/references/users/update-user-prefs.md | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index d2e68b114..c41564549 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1494,6 +1494,10 @@ App::patch('/v1/account/prefs') /** @var Appwrite\Event\Event $audits */ /** @var Appwrite\Stats\Stats $usage */ + if(\strlen($prefs) > 16384) { + throw new Exception('Maximum allowed prefs size exceeded.', 400); + } + $user = $dbForInternal->updateDocument('users', $user->getId(), $user->setAttribute('prefs', $prefs)); $audits diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index a5d412d5b..124ae14c6 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -591,6 +591,10 @@ App::patch('/v1/users/:userId/prefs') /** @var Utopia\Database\Database $dbForInternal */ /** @var Appwrite\Stats\Stats $usage */ + if(\strlen($prefs) > 16384) { + throw new Exception('Maximum allowed prefs size exceeded.', 400); + } + $user = $dbForInternal->getDocument('users', $userId); if ($user->isEmpty() || $user->getAttribute('deleted')) { diff --git a/docs/references/account/update-prefs.md b/docs/references/account/update-prefs.md index 8283f2f7c..3f8c12da5 100644 --- a/docs/references/account/update-prefs.md +++ b/docs/references/account/update-prefs.md @@ -1 +1 @@ -Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. \ No newline at end of file +Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 16384 characters and throws error if exceeded. \ No newline at end of file diff --git a/docs/references/users/update-user-prefs.md b/docs/references/users/update-user-prefs.md index 392736367..b0ea7a864 100644 --- a/docs/references/users/update-user-prefs.md +++ b/docs/references/users/update-user-prefs.md @@ -1 +1 @@ -Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. \ No newline at end of file +Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 16384 characters and throws error if exceeded. \ No newline at end of file From e3716ab2b846d777ea75e87816993c9294ade78d Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 13 Dec 2021 14:09:23 +0100 Subject: [PATCH 03/13] Included prefs size exceeded test --- composer.json | 2 +- tests/e2e/Services/Account/AccountBase.php | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f534615f2..01ba42c71 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.6.*", - "utopia-php/framework": "0.19.*", + "utopia-php/framework": "0.19.1", "utopia-php/abuse": "0.6.*", "utopia-php/analytics": "0.2.*", "utopia-php/audit": "0.7.*", diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index fc615fef8..0e2b5f7ae 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -3,6 +3,7 @@ namespace Tests\E2E\Services\Account; use Tests\E2E\Client; +use function array_merge; trait AccountBase { @@ -751,6 +752,29 @@ trait AccountBase $this->assertEquals($response['headers']['status-code'], 400); + /** + * Prefs size exceeded + */ + + $prefsObject = []; + // Add 1000 keys + for($i = 1000; $i < 2000; $i++) { + $prefsObject["key" + $i] = "HelloWorld"; + // Each key is 7 characters and value is 10 characters + } + // That makes total size minimum of 17 000, plus any JSON stuff. Max supported is 16384, so this should exceed. + + $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ]), [ + 'prefs' => $prefsObject + ]); + + $this->assertEquals($response['headers']['status-code'], 400); + return $data; } From 198382a60a42be7b48f02c95a011393a1d6ec49d Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 13 Dec 2021 14:18:44 +0100 Subject: [PATCH 04/13] Removed unnecessary use --- tests/e2e/Services/Account/AccountBase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 0e2b5f7ae..bca0ecfe0 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -3,7 +3,6 @@ namespace Tests\E2E\Services\Account; use Tests\E2E\Client; -use function array_merge; trait AccountBase { From 44721f840f96fd46d9aef025cbf5013eca95bd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 14 Dec 2021 10:34:51 +0100 Subject: [PATCH 05/13] Reverted version limitation --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 01ba42c71..f534615f2 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.6.*", - "utopia-php/framework": "0.19.1", + "utopia-php/framework": "0.19.*", "utopia-php/abuse": "0.6.*", "utopia-php/analytics": "0.2.*", "utopia-php/audit": "0.7.*", From e46b99b0a61bb044080f2c659cb2d1fde8849087 Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 20 Dec 2021 16:21:01 +0100 Subject: [PATCH 06/13] Implemented limit in a new way; second iteration --- app/config/collections.php | 2 +- app/controllers/api/account.php | 4 ---- app/controllers/api/users.php | 4 ---- docs/references/account/update-prefs.md | 2 +- docs/references/users/update-user-prefs.md | 2 +- tests/e2e/Services/Account/AccountBase.php | 10 +++++----- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index 30d9b79fb..1916ac671 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -998,7 +998,7 @@ $collections = [ '$id' => 'prefs', 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 65535, 'signed' => true, 'required' => false, 'default' => null, diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 291ddc0a0..775604152 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1480,10 +1480,6 @@ App::patch('/v1/account/prefs') /** @var Appwrite\Event\Event $audits */ /** @var Appwrite\Stats\Stats $usage */ - if(\strlen($prefs) > 16384) { - throw new Exception('Maximum allowed prefs size exceeded.', 400); - } - $user = $dbForInternal->updateDocument('users', $user->getId(), $user->setAttribute('prefs', $prefs)); $audits diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index baa4e2bd7..5cef36f6c 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -578,10 +578,6 @@ App::patch('/v1/users/:userId/prefs') /** @var Utopia\Database\Database $dbForInternal */ /** @var Appwrite\Stats\Stats $usage */ - if(\strlen($prefs) > 16384) { - throw new Exception('Maximum allowed prefs size exceeded.', 400); - } - $user = $dbForInternal->getDocument('users', $userId); if ($user->isEmpty() || $user->getAttribute('deleted')) { diff --git a/docs/references/account/update-prefs.md b/docs/references/account/update-prefs.md index 3f8c12da5..53f58cb5b 100644 --- a/docs/references/account/update-prefs.md +++ b/docs/references/account/update-prefs.md @@ -1 +1 @@ -Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 16384 characters and throws error if exceeded. \ No newline at end of file +Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. \ No newline at end of file diff --git a/docs/references/users/update-user-prefs.md b/docs/references/users/update-user-prefs.md index b0ea7a864..11b63efa4 100644 --- a/docs/references/users/update-user-prefs.md +++ b/docs/references/users/update-user-prefs.md @@ -1 +1 @@ -Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 16384 characters and throws error if exceeded. \ No newline at end of file +Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. \ No newline at end of file diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index bca0ecfe0..eb7f14d29 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -756,12 +756,12 @@ trait AccountBase */ $prefsObject = []; - // Add 1000 keys - for($i = 1000; $i < 2000; $i++) { - $prefsObject["key" + $i] = "HelloWorld"; - // Each key is 7 characters and value is 10 characters + // Add 1024 keys + for($i = 1000; $i < 2024; $i++) { + $prefsObject["key" + $i] = "HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHel"; + // Each key is 7 characters and value is 63 characters } - // That makes total size minimum of 17 000, plus any JSON stuff. Max supported is 16384, so this should exceed. + // That makes total size minimum of 70kB, plus any JSON stuff. Max supported is 64kB, so this should exceed. $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost', From 27a43beddc6dbec2b989a1216c9f375ddc55dfe5 Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 20 Dec 2021 16:37:17 +0100 Subject: [PATCH 07/13] Test bug fix --- tests/e2e/Services/Account/AccountBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index eb7f14d29..57a9d9699 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -758,7 +758,7 @@ trait AccountBase $prefsObject = []; // Add 1024 keys for($i = 1000; $i < 2024; $i++) { - $prefsObject["key" + $i] = "HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHel"; + $prefsObject["key" . $i] = "HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHel"; // Each key is 7 characters and value is 63 characters } // That makes total size minimum of 70kB, plus any JSON stuff. Max supported is 64kB, so this should exceed. From 5757a853f5798fe1828eb6c551b64d07f650333a Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Mon, 20 Dec 2021 16:56:58 +0100 Subject: [PATCH 08/13] Tests fixed, I hope --- tests/e2e/Services/Account/AccountBase.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 57a9d9699..040d7da3d 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -756,12 +756,17 @@ trait AccountBase */ $prefsObject = []; - // Add 1024 keys - for($i = 1000; $i < 2024; $i++) { - $prefsObject["key" . $i] = "HelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHelloWorldHel"; - // Each key is 7 characters and value is 63 characters + + $text1Kb = ""; + for($i = 0; $i < 1024; $i++) { + $text1Kb .= "🍰"; } - // That makes total size minimum of 70kB, plus any JSON stuff. Max supported is 64kB, so this should exceed. + + // Add 100 keys, each is 1kB + for($i = 0; $i < 100; $i++) { + $prefsObject["key" . $i] = $text1Kb; + } + // That makes total size minimum of 100kB, plus any JSON stuff. Max supported is 64kB, so this should exceed. $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost', @@ -772,7 +777,7 @@ trait AccountBase 'prefs' => $prefsObject ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); return $data; } From 491b163b273ead4109e424994f6aa06dc7c9515b Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Wed, 22 Dec 2021 09:08:37 +0100 Subject: [PATCH 09/13] Update text to HTTP response changes --- tests/e2e/Services/Account/AccountBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 040d7da3d..9f4069061 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -777,7 +777,7 @@ trait AccountBase 'prefs' => $prefsObject ]); - $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals(500, $response['headers']['status-code']); return $data; } From 628b3fc805f2dcb5bf30e6a9c1cf8bdf24d77231 Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Wed, 22 Dec 2021 09:34:31 +0100 Subject: [PATCH 10/13] Added non-multi-byte test --- tests/e2e/Services/Account/AccountBase.php | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 9f4069061..8fe3610cf 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -3,6 +3,7 @@ namespace Tests\E2E\Services\Account; use Tests\E2E\Client; +use function array_merge; trait AccountBase { @@ -764,9 +765,9 @@ trait AccountBase // Add 100 keys, each is 1kB for($i = 0; $i < 100; $i++) { - $prefsObject["key" . $i] = $text1Kb; + $prefsObject["k" . $i] = $text1Kb; } - // That makes total size minimum of 100kB, plus any JSON stuff. Max supported is 64kB, so this should exceed. + // That makes total size minimum of 100kB, plus key size, plus any JSON syntax stuff. Max supported is 64kB, so this should exceed. $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost', @@ -777,7 +778,28 @@ trait AccountBase 'prefs' => $prefsObject ]); - $this->assertEquals(500, $response['headers']['status-code']); + $this->assertEquals(400, $response['headers']['status-code']); + + // Now let's test the same thing, but with normal symbol instead of multi-byte cake emoji + $prefsObject = []; + $text1Kb = ""; + for($i = 0; $i < 1024; $i++) { + $text1Kb .= "A"; + } + for($i = 0; $i < 100; $i++) { + $prefsObject["key" . $i] = $text1Kb; + } + + $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session, + ]), [ + 'prefs' => $prefsObject + ]); + + $this->assertEquals(400, $response['headers']['status-code']); return $data; } From 06e1f6afd110ca87180e987a42f44725d4b5d673 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 Jan 2022 16:19:03 +0100 Subject: [PATCH 11/13] chore: composer update --- composer.lock | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/composer.lock b/composer.lock index 55c39bc51..ed081bd8c 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": "d32b727a743b3a8811ec64c56f308694", + "content-hash": "d0df4734e38f660ce979011d70155357", "packages": [ { "name": "adhocore/jwt", @@ -2255,11 +2255,17 @@ }, { "name": "utopia-php/framework", - "version": "dev-fix-get-args-after-init", + "version": "0.19.5", "source": { "type": "git", - "url": "https://github.com/utopia-php/framework", - "reference": "36a42dce039f043288673f0ff46284353543624d" + "url": "https://github.com/utopia-php/framework.git", + "reference": "1c28ba9a5b491cf7c90c535fefee5832c7133623" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/1c28ba9a5b491cf7c90c535fefee5832c7133623", + "reference": "1c28ba9a5b491cf7c90c535fefee5832c7133623", + "shasum": "" }, "require": { "php": ">=8.0.0" @@ -2274,6 +2280,7 @@ "Utopia\\": "src/" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2289,7 +2296,11 @@ "php", "upf" ], - "time": "2022-01-03T08:38:34+00:00" + "support": { + "issues": "https://github.com/utopia-php/framework/issues", + "source": "https://github.com/utopia-php/framework/tree/0.19.5" + }, + "time": "2022-01-04T14:40:23+00:00" }, { "name": "utopia-php/image", @@ -3069,16 +3080,16 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.16.3", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "6185cdfe4c4261287240639f3a7fdc05e7ae2337" + "reference": "a68e072170a81532cfb0ff914864d8f074a73a37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6185cdfe4c4261287240639f3a7fdc05e7ae2337", - "reference": "6185cdfe4c4261287240639f3a7fdc05e7ae2337", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/a68e072170a81532cfb0ff914864d8f074a73a37", + "reference": "a68e072170a81532cfb0ff914864d8f074a73a37", "shasum": "" }, "require": { @@ -3112,9 +3123,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.16.3" + "source": "https://github.com/appwrite/sdk-generator/tree/0.17.0" }, - "time": "2021-12-16T23:56:47+00:00" + "time": "2022-01-04T09:24:44+00:00" }, { "name": "composer/pcre", @@ -6628,18 +6639,9 @@ "time": "2015-12-17T08:42:14+00:00" } ], - "aliases": [ - { - "package": "utopia-php/framework", - "version": "dev-fix-get-args-after-init", - "alias": "0.19", - "alias_normalized": "0.19.0.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/framework": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 972ce959b6278f65db69a2e91a551623d1148f2e Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 Jan 2022 16:48:15 +0100 Subject: [PATCH 12/13] fix: tests --- phpunit.xml | 2 +- tests/e2e/Services/Account/AccountBase.php | 23 +++------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 2fbb75e22..ceba1dcbf 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" + stopOnFailure="true" > diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 8fe3610cf..fcb9e8c8f 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -756,18 +756,7 @@ trait AccountBase * Prefs size exceeded */ - $prefsObject = []; - - $text1Kb = ""; - for($i = 0; $i < 1024; $i++) { - $text1Kb .= "🍰"; - } - - // Add 100 keys, each is 1kB - for($i = 0; $i < 100; $i++) { - $prefsObject["k" . $i] = $text1Kb; - } - // That makes total size minimum of 100kB, plus key size, plus any JSON syntax stuff. Max supported is 64kB, so this should exceed. + $prefsObject = ["longValue" => str_repeat("🍰", 100000)]; $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost', @@ -781,14 +770,8 @@ trait AccountBase $this->assertEquals(400, $response['headers']['status-code']); // Now let's test the same thing, but with normal symbol instead of multi-byte cake emoji - $prefsObject = []; - $text1Kb = ""; - for($i = 0; $i < 1024; $i++) { - $text1Kb .= "A"; - } - for($i = 0; $i < 100; $i++) { - $prefsObject["key" . $i] = $text1Kb; - } + $prefsObject = ["longValue" => str_repeat("-", 100000)]; + $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost', From 49e9e1b9cd2840798518aed67073f01ac3eb7690 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 4 Jan 2022 16:50:48 +0100 Subject: [PATCH 13/13] fix: tests --- phpunit.xml | 2 +- tests/e2e/Services/Account/AccountBase.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index ceba1dcbf..2fbb75e22 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="true" + stopOnFailure="false" > diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index fcb9e8c8f..2b0da9965 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -755,7 +755,6 @@ trait AccountBase /** * Prefs size exceeded */ - $prefsObject = ["longValue" => str_repeat("🍰", 100000)]; $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ @@ -772,7 +771,6 @@ trait AccountBase // Now let's test the same thing, but with normal symbol instead of multi-byte cake emoji $prefsObject = ["longValue" => str_repeat("-", 100000)]; - $response = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([ 'origin' => 'http://localhost', 'content-type' => 'application/json',