From 135868cc2df7e55fe99ef13233e64dc21008eee6 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Thu, 16 Mar 2023 09:56:53 +0000 Subject: [PATCH 1/4] handle empty and null values for php 8.1 --- core/TagParser.php | 4 ++++ tests/core/tag/TagMarkdownParserTest.php | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/core/TagParser.php b/core/TagParser.php index b7bc3fd03..d5b54a99d 100644 --- a/core/TagParser.php +++ b/core/TagParser.php @@ -80,6 +80,10 @@ public static function convert($text) */ public static function convertWithMarkdown($text) { + if (empty($text)) { + return $text; + } + return (new TagMarkdownParser())->parse(static::convert($text)); } diff --git a/tests/core/tag/TagMarkdownParserTest.php b/tests/core/tag/TagMarkdownParserTest.php index 2c3082b96..5429ce98b 100644 --- a/tests/core/tag/TagMarkdownParserTest.php +++ b/tests/core/tag/TagMarkdownParserTest.php @@ -3,6 +3,7 @@ namespace luyatests\core\tag; use luya\tag\TagMarkdownParser; +use luya\TagParser; use luyatests\LuyaWebTestCase; class StubTagMarkdownParser extends TagMarkdownParser @@ -15,6 +16,11 @@ public function stubParseUrl($url) class TagMarkdownParserTest extends LuyaWebTestCase { + public function testNullValues() + { + $this->assertNull(TagParser::convertWithMarkdown(null)); + } + public function testNewline() { $parser = new TagMarkdownParser(); From 95120028a6cb3a920cbe8fe24f0c54e54a98050b Mon Sep 17 00:00:00 2001 From: nadar Date: Thu, 16 Mar 2023 09:57:37 +0000 Subject: [PATCH 2/4] Apply php-cs-fixer changes --- core/TagParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/TagParser.php b/core/TagParser.php index d5b54a99d..973ec25dc 100644 --- a/core/TagParser.php +++ b/core/TagParser.php @@ -83,7 +83,7 @@ public static function convertWithMarkdown($text) if (empty($text)) { return $text; } - + return (new TagMarkdownParser())->parse(static::convert($text)); } From 0ed43db71f97895b9f80f8735cf553efb10c5055 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Thu, 16 Mar 2023 10:01:50 +0000 Subject: [PATCH 3/4] changelog --- core/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 81c8f90e6..951c21c0d 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -7,7 +7,8 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE > Check the [UPGRADE document](UPGRADE.md) to read more about breaking changes. -+ [#2165](https://github.com/luyadev/luya/pull/2165) Official deprecated unit tests for php 7.0 and 7.1. Code is unchanged. ++ [#2165](https://github.com/luyadev/luya/pull/2165) Officially deprecated unit tests for php 7.0 and 7.1. Code is unchanged. ++ [#2182](https://github.com/luyadev/luya/pull/2182) Ensure PHP 8.1 compatibility when `TagParser::convertWithMarkdown()` recieves an empty value. ## 2.2.1 (5. October 2022) From 009130b34910feba178d182c032a5718c8ded993 Mon Sep 17 00:00:00 2001 From: Basil Suter Date: Thu, 16 Mar 2023 10:04:36 +0000 Subject: [PATCH 4/4] format json [skip ci] --- composer.json | 162 ++++++++++++++++++++++----------------------- core/composer.json | 108 +++++++++++++++--------------- 2 files changed, 135 insertions(+), 135 deletions(-) diff --git a/composer.json b/composer.json index ae58ed934..b3e01aae5 100644 --- a/composer.json +++ b/composer.json @@ -1,82 +1,82 @@ { - "name": "luyadev/luya", - "description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.", - "type": "project", - "keywords": [ - "php", - "yii2", - "cms", - "luya", - "website", - "content", - "angular", - "modules", - "framework" - ], - "license": "MIT", - "homepage": "https://luya.io", - "authors": [ - { - "name": "Basil Suter", - "email": "git@nadar.io", - "homepage": "https://github.com/nadar" - } - ], - "support": { - "issues": "https://github.com/luyadev/luya/issues" - }, - "require": { - "luyadev/luya-composer": "^1.0", - "luyadev/yii-helpers": "^1.0", - "yiisoft/yii2": "~2.0.15", - "curl/curl": "^2.0 || ^1.0", - "phpmailer/phpmailer": "^6.0", - "nadar/php-composer-reader": "^1.0", - "cpliakas/git-wrapper": "^1.0 || ^2.0", - "giggsey/libphonenumber-for-php": "^8.11" - }, - "require-dev": { - "luyadev/luya-testsuite": "^2.0", - "nadar/github-markdown-fixer": "^1.0", - "unglue/client": "^1.5", - "friendsofphp/php-cs-fixer": "^3.2", - "phpstan/phpstan": "^1.7", - "rector/rector": "^0.14.2" - }, - "autoload": { - "psr-4": { - "luya\\": "core/", - "luya\\dev\\": "dev", - "luyatests\\": "tests/" - } - }, - "extra": { - "asset-installer-paths": { - "bower-asset-library": "vendor/bower" - } - }, - "config": { - "fxp-asset": { - "enabled": false - }, - "allow-plugins": { - "yiisoft/yii2-composer": true, - "luyadev/luya-composer": true - } - }, - "bin": [ - "core/bin/luya", - "dev/luyadev" - ], - "repositories": [ - { - "type": "composer", - "url": "https://asset-packagist.org" - } - ], - "scripts": { - "phpstan": "vendor/bin/phpstan -v", - "phpcsfixer": "vendor/bin/php-cs-fixer fix", - "rector": "vendor/bin/rector" - } -} \ No newline at end of file + "name": "luyadev/luya", + "description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.", + "type": "project", + "keywords": [ + "php", + "yii2", + "cms", + "luya", + "website", + "content", + "angular", + "modules", + "framework" + ], + "license": "MIT", + "homepage": "https://luya.io", + "authors": [ + { + "name": "Basil Suter", + "email": "git@nadar.io", + "homepage": "https://github.com/nadar" + } + ], + "support": { + "issues": "https://github.com/luyadev/luya/issues" + }, + "require": { + "luyadev/luya-composer": "^1.0", + "luyadev/yii-helpers": "^1.0", + "yiisoft/yii2": "~2.0.15", + "curl/curl": "^2.0 || ^1.0", + "phpmailer/phpmailer": "^6.0", + "nadar/php-composer-reader": "^1.0", + "cpliakas/git-wrapper": "^1.0 || ^2.0", + "giggsey/libphonenumber-for-php": "^8.11" + }, + "require-dev": { + "luyadev/luya-testsuite": "^2.0", + "nadar/github-markdown-fixer": "^1.0", + "unglue/client": "^1.5", + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^1.7", + "rector/rector": "^0.14.2" + }, + "autoload": { + "psr-4": { + "luya\\": "core/", + "luya\\dev\\": "dev", + "luyatests\\": "tests/" + } + }, + "extra": { + "asset-installer-paths": { + "bower-asset-library": "vendor/bower" + } + }, + "config": { + "fxp-asset": { + "enabled": false + }, + "allow-plugins": { + "yiisoft/yii2-composer": true, + "luyadev/luya-composer": true + } + }, + "bin": [ + "core/bin/luya", + "dev/luyadev" + ], + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ], + "scripts": { + "phpstan": "vendor/bin/phpstan -v", + "phpcsfixer": "vendor/bin/php-cs-fixer fix", + "rector": "vendor/bin/rector" + } +} diff --git a/core/composer.json b/core/composer.json index 10b429644..c96936621 100644 --- a/core/composer.json +++ b/core/composer.json @@ -1,56 +1,56 @@ { - "name": "luyadev/luya-core", - "description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.", - "type": "luya-core", - "keywords": [ - "luya", - "core", - "yii2", - "yii", - "cms", - "admin" - ], - "license": "MIT", - "homepage": "https://luya.io", - "authors": [ - { - "name": "Basil Suter", - "email": "git@nadar.io", - "homepage": "https://github.com/nadar" - } - ], - "support": { - "issues": "https://github.com/luyadev/luya/issues" + "name": "luyadev/luya-core", + "description": "LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.", + "type": "luya-core", + "keywords": [ + "luya", + "core", + "yii2", + "yii", + "cms", + "admin" + ], + "license": "MIT", + "homepage": "https://luya.io", + "authors": [ + { + "name": "Basil Suter", + "email": "git@nadar.io", + "homepage": "https://github.com/nadar" + } + ], + "support": { + "issues": "https://github.com/luyadev/luya/issues" + }, + "require": { + "luyadev/luya-composer": "^1.0", + "luyadev/yii-helpers": "^1.0", + "yiisoft/yii2": "~2.0.15", + "curl/curl": "^2.0 || ^1.0", + "phpmailer/phpmailer": "^6.0", + "giggsey/libphonenumber-for-php": "^8.11" + }, + "autoload": { + "psr-4": { + "luya\\": "" + } + }, + "config": { + "fxp-asset": { + "enabled": false }, - "require": { - "luyadev/luya-composer": "^1.0", - "luyadev/yii-helpers": "^1.0", - "yiisoft/yii2": "~2.0.15", - "curl/curl": "^2.0 || ^1.0", - "phpmailer/phpmailer": "^6.0", - "giggsey/libphonenumber-for-php": "^8.11" - }, - "autoload": { - "psr-4": { - "luya\\": "" - } - }, - "config": { - "fxp-asset": { - "enabled": false - }, - "allow-plugins": { - "yiisoft/yii2-composer": true, - "luyadev/luya-composer": true - } - }, - "repositories": [ - { - "type": "composer", - "url": "https://asset-packagist.org" - } - ], - "bin": [ - "bin/luya" - ] -} \ No newline at end of file + "allow-plugins": { + "yiisoft/yii2-composer": true, + "luyadev/luya-composer": true + } + }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ], + "bin": [ + "bin/luya" + ] +}