From 111df763039643df8687271b40c07856719f33ae Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 4 Sep 2024 10:48:54 -0500 Subject: [PATCH 1/5] changing the mb_strlen to strlen --- phalcon/Encryption/Crypt.zep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phalcon/Encryption/Crypt.zep b/phalcon/Encryption/Crypt.zep index f8cc66eeb5..103f742517 100644 --- a/phalcon/Encryption/Crypt.zep +++ b/phalcon/Encryption/Crypt.zep @@ -450,7 +450,7 @@ class Crypt implements CryptInterface return false; } - return length <= mb_strlen(input); + return length <= strlen(input); } /** @@ -633,7 +633,7 @@ class Crypt implements CryptInterface paddingSize = 0; if true === this->checkIsMode(["cbc", "ecb"], mode) { - let paddingSize = blockSize - (mb_strlen(input) % blockSize); + let paddingSize = blockSize - (strlen(input) % blockSize); if paddingSize >= 256 || paddingSize < 0 { throw new Exception( From f619a2741f431c1844a2d5c8b42048301e91bd73 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 4 Sep 2024 11:21:47 -0500 Subject: [PATCH 2/5] updating changelog --- CHANGELOG-5.0.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 2da0a437af..b5ceff1036 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -6,6 +6,16 @@ - Changed `Phalcon\Filter\Validation\Validator\Email` to allow UTF8 in local part. [#16637](https://github.com/phalcon/cphalcon/issues/16637) +### Added + + +### Fixed + +- Fixed `Phalcon\Encryption\Crypt` to use `strlen` instead of `mb_strlen` for padding calculations [#16642](https://github.com/phalcon/cphalcon/issues/16642) + +### Removed + + ## [5.8.0](https://github.com/phalcon/cphalcon/releases/tag/v5.8.0) (2024-07-09) ### Changed From 6a9bb74d502bca53d37fa90ce409a94ad8578f05 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 4 Sep 2024 11:22:50 -0500 Subject: [PATCH 3/5] updating composer --- composer.lock | 338 ++++++++++++++++++++++++++------------------------ 1 file changed, 173 insertions(+), 165 deletions(-) diff --git a/composer.lock b/composer.lock index b655aadcfd..0979ab18b8 100644 --- a/composer.lock +++ b/composer.lock @@ -1077,30 +1077,38 @@ }, { "name": "composer/pcre", - "version": "3.1.4", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "04229f163664973f68f38f6f73d917799168ef24" + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", - "reference": "04229f163664973f68f38f6f73d917799168ef24", + "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.10", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -1128,7 +1136,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.4" + "source": "https://github.com/composer/pcre/tree/3.3.1" }, "funding": [ { @@ -1144,20 +1152,20 @@ "type": "tidelift" } ], - "time": "2024-05-27T13:40:54+00:00" + "time": "2024-08-27T18:44:43+00:00" }, { "name": "composer/semver", - "version": "3.4.0", + "version": "3.4.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", "shasum": "" }, "require": { @@ -1209,7 +1217,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" + "source": "https://github.com/composer/semver/tree/3.4.2" }, "funding": [ { @@ -1225,7 +1233,7 @@ "type": "tidelift" } ], - "time": "2023-08-31T09:50:34+00:00" + "time": "2024-07-12T11:35:52+00:00" }, { "name": "composer/xdebug-handler", @@ -1597,16 +1605,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" + "reference": "8520451a140d3f46ac33042715115e290cf5785f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f", + "reference": "8520451a140d3f46ac33042715115e290cf5785f", "shasum": "" }, "require": { @@ -1646,7 +1654,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0" }, "funding": [ { @@ -1654,20 +1662,20 @@ "type": "github" } ], - "time": "2024-02-07T09:43:46+00:00" + "time": "2024-08-06T10:04:20+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.3", + "version": "v3.64.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" + "reference": "58dd9c931c785a79739310aef5178928305ffa67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67", + "reference": "58dd9c931c785a79739310aef5178928305ffa67", "shasum": "" }, "require": { @@ -1749,7 +1757,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0" }, "funding": [ { @@ -1757,28 +1765,28 @@ "type": "github" } ], - "time": "2024-06-16T14:17:03+00:00" + "time": "2024-08-30T23:09:38+00:00" }, { "name": "graham-campbell/result-type", - "version": "v1.1.2", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" + "phpoption/phpoption": "^1.9.3" }, "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "autoload": { @@ -1807,7 +1815,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" }, "funding": [ { @@ -1819,26 +1827,26 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:16:48+00:00" + "time": "2024-07-20T21:45:45+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.8.1", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", - "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5.3 || ^2.0.1", - "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -1849,9 +1857,9 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", - "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "guzzle/client-integration-tests": "3.0.2", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -1929,7 +1937,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -1945,20 +1953,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:35:24+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", - "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", "shasum": "" }, "require": { @@ -1966,7 +1974,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "type": "library", "extra": { @@ -2012,7 +2020,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.2" + "source": "https://github.com/guzzle/promises/tree/2.0.3" }, "funding": [ { @@ -2028,20 +2036,20 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:19:20+00:00" + "time": "2024-07-18T10:29:17+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", - "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", "shasum": "" }, "require": { @@ -2056,8 +2064,8 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.36 || ^9.6.15" + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -2128,7 +2136,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.2" + "source": "https://github.com/guzzle/psr7/tree/2.7.0" }, "funding": [ { @@ -2144,7 +2152,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T20:05:35+00:00" + "time": "2024-07-18T11:15:46+00:00" }, { "name": "monolog/monolog", @@ -2467,16 +2475,16 @@ }, { "name": "phalcon/ide-stubs", - "version": "v5.7.0", + "version": "v5.8.0", "source": { "type": "git", "url": "https://github.com/phalcon/ide-stubs.git", - "reference": "dbf1a87285da674d096566fb36732614e70ef57b" + "reference": "f9cc44828f6d4b8110c633a274a9da7067973800" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phalcon/ide-stubs/zipball/dbf1a87285da674d096566fb36732614e70ef57b", - "reference": "dbf1a87285da674d096566fb36732614e70ef57b", + "url": "https://api.github.com/repos/phalcon/ide-stubs/zipball/f9cc44828f6d4b8110c633a274a9da7067973800", + "reference": "f9cc44828f6d4b8110c633a274a9da7067973800", "shasum": "" }, "require": { @@ -2530,7 +2538,7 @@ "type": "open_collective" } ], - "time": "2024-05-20T13:24:33+00:00" + "time": "2024-07-18T22:40:31+00:00" }, { "name": "phalcon/zephir", @@ -2538,12 +2546,12 @@ "source": { "type": "git", "url": "https://github.com/zephir-lang/zephir.git", - "reference": "b0dd977ec987e945e67be73309d77fb2ab95e346" + "reference": "13d9724e00605bac6f34a05c6b054d76d62b6de9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zephir-lang/zephir/zipball/b0dd977ec987e945e67be73309d77fb2ab95e346", - "reference": "b0dd977ec987e945e67be73309d77fb2ab95e346", + "url": "https://api.github.com/repos/zephir-lang/zephir/zipball/13d9724e00605bac6f34a05c6b054d76d62b6de9", + "reference": "13d9724e00605bac6f34a05c6b054d76d62b6de9", "shasum": "" }, "require": { @@ -2616,7 +2624,7 @@ "type": "github" } ], - "time": "2024-06-09T20:01:55+00:00" + "time": "2024-09-04T11:09:07+00:00" }, { "name": "phar-io/manifest", @@ -2913,16 +2921,16 @@ }, { "name": "phpoption/phpoption", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", "shasum": "" }, "require": { @@ -2930,13 +2938,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "1.9-dev" @@ -2972,7 +2980,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" }, "funding": [ { @@ -2984,20 +2992,20 @@ "type": "tidelift" } ], - "time": "2023-11-12T21:59:55+00:00" + "time": "2024-07-20T21:41:07+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.1", + "version": "1.30.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" + "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", - "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5ceb0e384997db59f38774bf79c2a6134252c08f", + "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f", "shasum": "" }, "require": { @@ -3029,41 +3037,41 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.0" }, - "time": "2024-05-31T08:52:43+00:00" + "time": "2024-08-29T09:54:52+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -3072,7 +3080,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -3101,7 +3109,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -3109,7 +3117,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3354,45 +3362,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "9.6.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "49d7820565836236411f5dc002d16dd689cde42f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", + "reference": "49d7820565836236411f5dc002d16dd689cde42f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -3437,7 +3445,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" }, "funding": [ { @@ -3453,7 +3461,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2024-07-10T11:45:39+00:00" }, { "name": "predis/predis", @@ -4252,31 +4260,31 @@ }, { "name": "react/socket", - "version": "v1.15.0", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/reactphp/socket.git", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", - "react/dns": "^1.11", + "react/dns": "^1.13", "react/event-loop": "^1.2", - "react/promise": "^3 || ^2.6 || ^1.2.1", - "react/stream": "^1.2" + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4 || ^3 || ^2", + "react/async": "^4.3 || ^3.3 || ^2", "react/promise-stream": "^1.4", - "react/promise-timer": "^1.10" + "react/promise-timer": "^1.11" }, "type": "library", "autoload": { @@ -4320,7 +4328,7 @@ ], "support": { "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.15.0" + "source": "https://github.com/reactphp/socket/tree/v1.16.0" }, "funding": [ { @@ -4328,7 +4336,7 @@ "type": "open_collective" } ], - "time": "2023-12-15T11:02:10+00:00" + "time": "2024-07-26T10:38:09+00:00" }, { "name": "react/stream", @@ -5441,16 +5449,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.1", + "version": "3.10.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -5517,7 +5525,7 @@ "type": "open_collective" } ], - "time": "2024-05-22T21:24:41+00:00" + "time": "2024-07-21T23:26:44+00:00" }, { "name": "symfony/browser-kit", @@ -5593,16 +5601,16 @@ }, { "name": "symfony/console", - "version": "v5.4.41", + "version": "v5.4.43", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6473d441a913cb997123b59ff2dbe3d1cf9e11ba" + "reference": "e86f8554de667c16dde8aeb89a3990cfde924df9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6473d441a913cb997123b59ff2dbe3d1cf9e11ba", - "reference": "6473d441a913cb997123b59ff2dbe3d1cf9e11ba", + "url": "https://api.github.com/repos/symfony/console/zipball/e86f8554de667c16dde8aeb89a3990cfde924df9", + "reference": "e86f8554de667c16dde8aeb89a3990cfde924df9", "shasum": "" }, "require": { @@ -5672,7 +5680,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.41" + "source": "https://github.com/symfony/console/tree/v5.4.43" }, "funding": [ { @@ -5688,7 +5696,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T07:48:55+00:00" + "time": "2024-08-13T16:31:56+00:00" }, { "name": "symfony/css-selector", @@ -6127,16 +6135,16 @@ }, { "name": "symfony/finder", - "version": "v5.4.40", + "version": "v5.4.43", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "f51cff4687547641c7d8180d74932ab40b2205ce" + "reference": "ae25a9145a900764158d439653d5630191155ca0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/f51cff4687547641c7d8180d74932ab40b2205ce", - "reference": "f51cff4687547641c7d8180d74932ab40b2205ce", + "url": "https://api.github.com/repos/symfony/finder/zipball/ae25a9145a900764158d439653d5630191155ca0", + "reference": "ae25a9145a900764158d439653d5630191155ca0", "shasum": "" }, "require": { @@ -6170,7 +6178,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.40" + "source": "https://github.com/symfony/finder/tree/v5.4.43" }, "funding": [ { @@ -6186,7 +6194,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:33:22+00:00" + "time": "2024-08-13T14:03:51+00:00" }, { "name": "symfony/options-resolver", @@ -7097,16 +7105,16 @@ }, { "name": "symfony/yaml", - "version": "v5.4.40", + "version": "v5.4.43", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "81cad0ceab3d61fe14fe941ff18a230ac9c80f83" + "reference": "62f96e1cfd4cf518882a36bfedcf1fe4093c1299" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/81cad0ceab3d61fe14fe941ff18a230ac9c80f83", - "reference": "81cad0ceab3d61fe14fe941ff18a230ac9c80f83", + "url": "https://api.github.com/repos/symfony/yaml/zipball/62f96e1cfd4cf518882a36bfedcf1fe4093c1299", + "reference": "62f96e1cfd4cf518882a36bfedcf1fe4093c1299", "shasum": "" }, "require": { @@ -7152,7 +7160,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.40" + "source": "https://github.com/symfony/yaml/tree/v5.4.43" }, "funding": [ { @@ -7168,7 +7176,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:33:22+00:00" + "time": "2024-08-11T17:40:32+00:00" }, { "name": "theseer/tokenizer", @@ -7410,23 +7418,23 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.0", + "version": "v5.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", + "graham-campbell/result-type": "^1.1.3", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", + "phpoption/phpoption": "^1.9.3", "symfony/polyfill-ctype": "^1.24", "symfony/polyfill-mbstring": "^1.24", "symfony/polyfill-php80": "^1.24" @@ -7443,7 +7451,7 @@ "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "5.6-dev" @@ -7478,7 +7486,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" }, "funding": [ { @@ -7490,7 +7498,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:43:29+00:00" + "time": "2024-07-20T21:52:34+00:00" }, { "name": "webmozart/assert", From 302e9961f9f1ee3c33e915646d9158749c72c5c3 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 3 Apr 2024 16:16:03 -0500 Subject: [PATCH 4/5] adjusted the tests and added one more --- .../Validator/Callback/ValidateCest.php | 2 +- .../StringLength/Max/ValidateCest.php | 45 ++-- .../StringLength/Min/ValidateCest.php | 41 ++- .../Validator/StringLength/ValidateCest.php | 242 ++++++++++-------- 4 files changed, 171 insertions(+), 159 deletions(-) diff --git a/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php b/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php index 5a153d3cdb..56003dc3ce 100644 --- a/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/Callback/ValidateCest.php @@ -146,7 +146,7 @@ public function filterValidationValidatorCallbackValidateSingleFieldValidator(In $messages = $validation->validate( [ - 'user' => 'user', + 'user' => '12345', 'admin' => null, ] ); diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php index 922057d6ea..a713afc1ff 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Max/ValidateCest.php @@ -72,26 +72,23 @@ public function filterValidationValidatorMaxStringLengthValidateSingleField(Inte $messages = $validation->validate( [ - 'name' => 'SomeValue', + 'name' => '12345678', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', + 'name' => '123456789', ] ); - $I->assertSame( - 1, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } /** @@ -120,26 +117,23 @@ public function filterValidationValidatorMaxOrEqualStringLengthValidateSingleFie $messages = $validation->validate( [ - 'name' => 'short', + 'name' => '12345', ] ); - $I->assertSame( - 0, - $messages->count() - ); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue', + 'name' => '1234567890', ] ); - $I->assertSame( - 1, - $messages->count() - ); - + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ @@ -147,9 +141,8 @@ public function filterValidationValidatorMaxOrEqualStringLengthValidateSingleFie ] ); - $I->assertSame( - 1, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php index 4d2b705082..ba150504ed 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/Min/ValidateCest.php @@ -43,8 +43,8 @@ public function filterValidationValidatorMinValidateEmpty(IntegrationTester $I) $entity->name = ''; $validation->bind($entity, []); - $result = $validator->validate($validation, 'name'); - $I->assertTrue($result); + $actual = $validator->validate($validation, 'name'); + $I->assertTrue($actual); } /** @@ -69,29 +69,26 @@ public function filterValidationValidatorMinStringLengthValidateSingleField(Inte ) ); - $messages = $validation->validate( [ - 'name' => 'SomeValue', + 'name' => '1234567890', ] ); - $I->assertSame( - 0, - $messages->count() - ); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', + 'name' => '123456789', ] ); - $I->assertSame( - 0, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } /** @@ -120,25 +117,23 @@ public function filterValidationValidatorMinOrEqualStringLengthValidateSingleFie $messages = $validation->validate( [ - 'name' => 'SomeValue', + 'name' => '12345678', ] ); - $I->assertSame( - 1, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', + 'name' => '1234567890', ] ); - $I->assertSame( - 0, - $messages->count() - ); + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } } diff --git a/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php b/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php index 0650826201..d54afe7127 100644 --- a/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php +++ b/tests/integration/Filter/Validation/Validator/StringLength/ValidateCest.php @@ -49,29 +49,25 @@ public function filterValidationValidatorStringLengthValidateSingleField(Integra ) ); - $messages = $validation->validate( [ - 'name' => 'SomeValue', + 'name' => '12345678', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', + 'name' => '123456789', ] ); - $I->assertSame( - 1, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } /** @@ -98,15 +94,13 @@ public function filterValidationValidatorStringLengthValidateMinimum(Integration $messages = $validation->validate( [ - 'name' => 'Something', + 'name' => '123456', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $expected = new Messages( [ @@ -121,7 +115,7 @@ public function filterValidationValidatorStringLengthValidateMinimum(Integration $messages = $validation->validate( [ - 'name' => 'So', + 'name' => '12', ] ); @@ -156,15 +150,13 @@ public function filterValidationValidatorStringLengthValidateMinimumWithCustomMe $messages = $validation->validate( [ - 'message' => 'Something', + 'message' => '123456', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $expected = new Messages( [ @@ -179,7 +171,7 @@ public function filterValidationValidatorStringLengthValidateMinimumWithCustomMe $messages = $validation->validate( [ - 'message' => 'So', + 'message' => '12', ] ); @@ -210,15 +202,13 @@ public function filterValidationValidatorStringLengthValidateMaximum(Integration $messages = $validation->validate( [ - 'name' => 'John', + 'name' => '123', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $expected = new Messages( [ @@ -233,7 +223,7 @@ public function filterValidationValidatorStringLengthValidateMaximum(Integration $messages = $validation->validate( [ - 'name' => 'Johannes', + 'name' => '1234', ] ); @@ -267,15 +257,13 @@ public function filterValidationValidatorStringLengthValidateMaximumWithCustomMe $messages = $validation->validate( [ - 'message' => 'Pet', + 'message' => '123', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $expected = new Messages( [ @@ -290,7 +278,7 @@ public function filterValidationValidatorStringLengthValidateMaximumWithCustomMe $messages = $validation->validate( [ - 'message' => 'Validation', + 'message' => '123456', ] ); @@ -340,28 +328,25 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldSingle $messages = $validation->validate( [ - 'name' => 'SomeValue', - 'type' => 'SomeValue', + 'name' => '1234', + 'type' => '1234', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', - 'type' => 'SomeValue', + 'name' => '123456789', + 'type' => '12345678', ] ); - $I->assertSame( - 1, - $messages->count() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $I->assertSame( $validationMaximumMessages['name'], @@ -371,25 +356,22 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldSingle $messages = $validation->validate( [ - 'name' => 'SomeValue123', - 'type' => 'SomeValue123', + 'name' => '123456789', + 'type' => '123456789', ] ); - $I->assertSame( - 2, - $messages->count() - ); + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); - $I->assertSame( - $validationMaximumMessages['name'], - $messages->offsetGet(0)->getMessage() - ); + $expected = $validationMaximumMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); - $I->assertSame( - $validationMaximumMessages['type'], - $messages->offsetGet(1)->getMessage() - ); + $expected = $validationMaximumMessages['type']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); } /** @@ -436,76 +418,118 @@ public function filterValidationValidatorStringLengthValidateMultipleFieldMultip ) ); - $messages = $validation->validate( [ - 'name' => 'SomeValue', - 'type' => 'Some', + 'name' => '12345678', + 'type' => '123', ] ); - $I->assertSame( - 0, - $messages->count() - ); - + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', - 'type' => 'Some', + 'name' => '1234567890', + 'type' => '123', ] ); - $I->assertSame( - 1, - $messages->count() - ); - - $I->assertSame( - $validationMaximumMessages['name'], - $messages->offsetGet(0)->getMessage() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + $expected = $validationMaximumMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue', - 'type' => 'SomeValue', + 'name' => '12345678', + 'type' => '12345', ] ); - $I->assertSame( - 1, - $messages->count() - ); - - $I->assertSame( - $validationMaximumMessages['type'], - $messages->offsetGet(0)->getMessage() - ); + $expected = 1; + $actual = $messages->count(); + $I->assertSame($expected, $actual); + $expected = $validationMaximumMessages['type']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); $messages = $validation->validate( [ - 'name' => 'SomeValue123', - 'type' => 'SomeValue', + 'name' => '1234567890', + 'type' => '12345', ] ); - $I->assertSame( - 2, - $messages->count() - ); + $expected = 2; + $actual = $messages->count(); + $I->assertSame($expected, $actual); - $I->assertSame( - $validationMaximumMessages['name'], - $messages->offsetGet(0)->getMessage() + $expected = $validationMaximumMessages['name']; + $actual = $messages->offsetGet(0)->getMessage(); + $I->assertSame($expected, $actual); + + $expected = $validationMaximumMessages['type']; + $actual = $messages->offsetGet(1)->getMessage(); + $I->assertSame($expected, $actual); + } + + + /** + * Tests Phalcon\Filter\Validation\Validator\StringLength :: validate() - 16560 + * + * @author Phalcon Team + * @since 2024-04-03 + * @issue 16560 + */ + public function filterValidationValidatorStringLengthValidate16560(IntegrationTester $I) + { + $I->wantToTest('Validation\Validator\StringLength :: validate() - 16560'); + + $data = []; + $data['testMin'] = '12345678'; + $data['testMax'] = '12345678901234567890'; + + $validation = new Validation(); + + + $validation->add( + 'testMin', + new StringLength( + [ + "min" => 8, + "max" => 20, + "messageMinimum" => "minimum length requirement failed.", + "messageMaximum" => "maximum length requirement failed.", + "includedMinimum" => true, + "includedMaximum" => true + ] + ) ); - $I->assertSame( - $validationMaximumMessages['type'], - $messages->offsetGet(1)->getMessage() + $validation->add( + 'testMax', + new StringLength( + [ + "min" => 8, + "max" => 20, + "messageMinimum" => "minimum length requirement failed.", + "messageMaximum" => "maximum length requirement failed.", + "includedMinimum" => true, + "includedMaximum" => true + ] + ) ); + + $messages = $validation->validate($data); + + $expected = 0; + $actual = $messages->count(); + $I->assertSame($expected, $actual); } } From 2a3054df068ba7717bb38644f52ee951dcbcbc5d Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Wed, 3 Apr 2024 16:15:49 -0500 Subject: [PATCH 5/5] fixed the min/max --- phalcon/Filter/Validation/Validator/StringLength/Max.zep | 8 ++++---- phalcon/Filter/Validation/Validator/StringLength/Min.zep | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phalcon/Filter/Validation/Validator/StringLength/Max.zep b/phalcon/Filter/Validation/Validator/StringLength/Max.zep index 168ffd8954..407ba16749 100644 --- a/phalcon/Filter/Validation/Validator/StringLength/Max.zep +++ b/phalcon/Filter/Validation/Validator/StringLength/Max.zep @@ -86,7 +86,7 @@ class Max extends AbstractValidator */ public function validate( validation, var field) -> bool { - var value, length, maximum, replacePairs, included, result; + var failed, included, length, maximum, replacePairs, value; let value = validation->getValue(field); if this->allowEmpty(field, value) { @@ -115,12 +115,12 @@ class Max extends AbstractValidator } if included { - let result = length >= maximum; + let failed = length > maximum; } else { - let result = length > maximum; + let failed = length >= maximum; } - if result { + if failed { let replacePairs = [ ":max" : maximum ]; diff --git a/phalcon/Filter/Validation/Validator/StringLength/Min.zep b/phalcon/Filter/Validation/Validator/StringLength/Min.zep index c72797eadf..3773ed3386 100644 --- a/phalcon/Filter/Validation/Validator/StringLength/Min.zep +++ b/phalcon/Filter/Validation/Validator/StringLength/Min.zep @@ -86,7 +86,7 @@ class Min extends AbstractValidator */ public function validate( validation, var field) -> bool { - var value, length, minimum, replacePairs, included, result; + var failed, included, length, minimum, replacePairs, value; let value = validation->getValue(field); if this->allowEmpty(field, value) { @@ -115,12 +115,12 @@ class Min extends AbstractValidator } if included { - let result = length <= minimum; + let failed = length < minimum; } else { - let result = length < minimum; + let failed = length <= minimum; } - if result { + if failed { let replacePairs = [ ":min" : minimum ];