Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #4520
James Colea8e9ba304101
diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.phpindex ec1fba24b0..5df051cbd7 100644--- a/app/Support/Http/Controllers/CreateStuff.php+++ b/app/Support/Http/Controllers/CreateStuff.php@@ -30,6 +30,8 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\User;use Laravel\Passport\Passport;use Log;+use phpseclib\Crypt\RSA as LegacyRSA;+use phpseclib3\Crypt\RSA;/**@@ -104,21 +106,7 @@ trait CreateStuff*/protected function createOAuthKeys(): void // create stuff{- // switch on PHP version.- $result = version_compare(phpversion(), '8.0');- Log::info(sprintf('PHP version is %s', $result));- if (-1 === $result) {- Log::info('Will run PHP7 code.');- // PHP 7- $rsa = new \phpseclib\Crypt\RSA;- $keys = $rsa->createKey(4096);- }- if ($result >= 0) {- Log::info('Will run PHP8 code.');- // PHP 8- $keys = \phpseclib3\Crypt\RSA::createKey(4096);- }[$publicKey, $privateKey] = [Passport::keyPath('oauth-public.key'),@@ -128,6 +116,22 @@ trait CreateStuffif (file_exists($publicKey) || file_exists($privateKey)) {return;}++ // switch on class existence.++ Log::info(sprintf('PHP version is %s', phpversion()));+ if (class_exists(LegacyRSA::class)) {+ // PHP 7+ Log::info('Will run PHP7 code.');+ $keys = (new LegacyRSA)->createKey(4096);+ }++ if (!class_exists(LegacyRSA::class)) {+ // PHP 8+ Log::info('Will run PHP8 code.');+ $keys = RSA::createKey(4096);+ }+// @codeCoverageIgnoreStartLog::alert('NO OAuth keys were found. They have been created.');diff --git a/composer.lock b/composer.lockindex 5828ad86e0..118c847a96 100644--- a/composer.lock+++ b/composer.lock@@ -1254,22 +1254,22 @@},{"name": "guzzlehttp/guzzle",- "version": "7.2.0",+ "version": "7.3.0","source": {"type": "git","url": "https://github.com/guzzle/guzzle.git",- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79"+ "reference": "7008573787b430c1c1f650e3722d9bba59967628"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79",- "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79",+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628",+ "reference": "7008573787b430c1c1f650e3722d9bba59967628","shasum": ""},"require": {"ext-json": "*","guzzlehttp/promises": "^1.4",- "guzzlehttp/psr7": "^1.7",+ "guzzlehttp/psr7": "^1.7 || ^2.0","php": "^7.2.5 || ^8.0","psr/http-client": "^1.0"},@@ -1277,6 +1277,7 @@"psr/http-client-implementation": "1.0"},"require-dev": {+ "bamarni/composer-bin-plugin": "^1.4.1","ext-curl": "*","php-http/client-integration-tests": "^3.0","phpunit/phpunit": "^8.5.5 || ^9.3.5",@@ -1290,7 +1291,7 @@"type": "library","extra": {"branch-alias": {- "dev-master": "7.1-dev"+ "dev-master": "7.3-dev"}},"autoload": {@@ -1332,7 +1333,7 @@],"support": {"issues": "https://github.com/guzzle/guzzle/issues",- "source": "https://github.com/guzzle/guzzle/tree/7.2.0"+ "source": "https://github.com/guzzle/guzzle/tree/7.3.0"},"funding": [{@@ -1352,7 +1353,7 @@"type": "github"}],- "time": "2020-10-10T11:47:56+00:00"+ "time": "2021-03-23T11:33:13+00:00"},{"name": "guzzlehttp/promises",@@ -1411,16 +1412,16 @@},{"name": "guzzlehttp/psr7",- "version": "1.7.0",+ "version": "1.8.1","source": {"type": "git","url": "https://github.com/guzzle/psr7.git",- "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"+ "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",- "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/35ea11d335fd638b5882ff1725228b3d35496ab1",+ "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1","shasum": ""},"require": {@@ -1480,9 +1481,9 @@],"support": {"issues": "https://github.com/guzzle/psr7/issues",- "source": "https://github.com/guzzle/psr7/tree/1.7.0"+ "source": "https://github.com/guzzle/psr7/tree/1.8.1"},- "time": "2020-09-30T07:37:11+00:00"+ "time": "2021-03-21T16:25:00+00:00"},{"name": "jc5/google2fa-laravel",@@ -1641,16 +1642,16 @@},{"name": "laravel/framework",- "version": "v8.33.1",+ "version": "v8.34.0","source": {"type": "git","url": "https://github.com/laravel/framework.git",- "reference": "354c57b8cb457549114074c500944455a288d6cc"+ "reference": "81892ca110795a9c46c7e198cba7763bfd2af0bf"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/laravel/framework/zipball/354c57b8cb457549114074c500944455a288d6cc",- "reference": "354c57b8cb457549114074c500944455a288d6cc",+ "url": "https://api.github.com/repos/laravel/framework/zipball/81892ca110795a9c46c7e198cba7763bfd2af0bf",+ "reference": "81892ca110795a9c46c7e198cba7763bfd2af0bf","shasum": ""},"require": {@@ -1805,7 +1806,7 @@"issues": "https://github.com/laravel/framework/issues","source": "https://github.com/laravel/framework"},- "time": "2021-03-16T19:42:32+00:00"+ "time": "2021-03-23T15:12:51+00:00"},{"name": "laravel/passport",@@ -2077,16 +2078,16 @@},{"name": "lcobucci/jwt",- "version": "4.1.3",+ "version": "4.1.4","source": {"type": "git","url": "https://github.com/lcobucci/jwt.git",- "reference": "1e66927ea937c199539f8a8a35e284b6667c4f2c"+ "reference": "71cf170102c8371ccd933fa4df6252086d144de6"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/lcobucci/jwt/zipball/1e66927ea937c199539f8a8a35e284b6667c4f2c",- "reference": "1e66927ea937c199539f8a8a35e284b6667c4f2c",+ "url": "https://api.github.com/repos/lcobucci/jwt/zipball/71cf170102c8371ccd933fa4df6252086d144de6",+ "reference": "71cf170102c8371ccd933fa4df6252086d144de6","shasum": ""},"require": {@@ -2135,7 +2136,7 @@],"support": {"issues": "https://github.com/lcobucci/jwt/issues",- "source": "https://github.com/lcobucci/jwt/tree/4.1.3"+ "source": "https://github.com/lcobucci/jwt/tree/4.1.4"},"funding": [{@@ -2147,7 +2148,7 @@"type": "patreon"}],- "time": "2021-03-19T20:58:12+00:00"+ "time": "2021-03-23T23:53:08+00:00"},{"name": "league/commonmark",@@ -9551,16 +9552,16 @@},{"name": "phpunit/phpunit",- "version": "9.5.3",+ "version": "9.5.4","source": {"type": "git","url": "https://github.com/sebastianbergmann/phpunit.git",- "reference": "27241ac75fc37ecf862b6e002bf713b6566cbe41"+ "reference": "c73c6737305e779771147af66c96ca6a7ed8a741"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/27241ac75fc37ecf862b6e002bf713b6566cbe41",- "reference": "27241ac75fc37ecf862b6e002bf713b6566cbe41",+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741",+ "reference": "c73c6737305e779771147af66c96ca6a7ed8a741","shasum": ""},"require": {@@ -9638,7 +9639,7 @@],"support": {"issues": "https://github.com/sebastianbergmann/phpunit/issues",- "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.3"+ "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4"},"funding": [{@@ -9650,7 +9651,7 @@"type": "github"}],- "time": "2021-03-17T07:30:34+00:00"+ "time": "2021-03-23T07:16:29+00:00"},{"name": "react/promise",@@ -9708,12 +9709,12 @@"source": {"type": "git","url": "https://github.com/Roave/SecurityAdvisories.git",- "reference": "11b8a607a59818bb21fc9ffb334f03032a6ce5dc"+ "reference": "3dfe1d2b81a55b9c51dc87ce89f1ee2beaaf1093"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/11b8a607a59818bb21fc9ffb334f03032a6ce5dc",- "reference": "11b8a607a59818bb21fc9ffb334f03032a6ce5dc",+ "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/3dfe1d2b81a55b9c51dc87ce89f1ee2beaaf1093",+ "reference": "3dfe1d2b81a55b9c51dc87ce89f1ee2beaaf1093","shasum": ""},"conflict": {@@ -9953,7 +9954,9 @@"truckersmp/phpwhois": "<=4.3.1","twig/twig": "<1.38|>=2,<2.7","typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1",- "typo3/cms-core": ">=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1",+ "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1",+ "typo3/cms-core": ">=6.2,<=6.2.56|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1",+ "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1","typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5","typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4","typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1",@@ -10032,7 +10035,7 @@"type": "tidelift"}],- "time": "2021-03-19T20:02:32+00:00"+ "time": "2021-03-23T02:23:40+00:00"},{"name": "sebastian/cli-parser",