29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-24 22:39:31 +00:00

Update all Composer dependencies

This commit is contained in:
Michael Babker 2017-06-28 18:45:26 -05:00
parent 5e1f7a2b63
commit 050c2d17c5
65 changed files with 2154 additions and 1796 deletions

1
.gitignore vendored
View File

@ -101,6 +101,7 @@ Desktop.ini
/libraries/vendor/defuse/php-encryption/.php_cs
/libraries/vendor/defuse/php-encryption/composer.json
/libraries/vendor/defuse/php-encryption/README.md
/libraries/vendor/defuse/php-encryption/psalm.xml
/libraries/vendor/defuse/php-encryption/test.sh
/libraries/vendor/joomla/*/.appveyor.yml
/libraries/vendor/joomla/*/.gitattributes

303
composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [
{
"name": "composer/ca-bundle",
"version": "1.0.6",
"version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "a795611394b3c05164fd0eb291b492b39339cba4"
"reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/a795611394b3c05164fd0eb291b492b39339cba4",
"reference": "a795611394b3c05164fd0eb291b492b39339cba4",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
"reference": "b17e6153cb7f33c7e44eb59578dc12eee5dc8e12",
"shasum": ""
},
"require": {
@ -26,6 +26,7 @@
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.5",
"psr/log": "^1.0",
"symfony/process": "^2.5 || ^3.0"
},
@ -62,20 +63,20 @@
"ssl",
"tls"
],
"time": "2016-11-02T18:11:27+00:00"
"time": "2017-03-06T11:59:08+00:00"
},
{
"name": "defuse/php-encryption",
"version": "2.0.3",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/defuse/php-encryption.git",
"reference": "2c6fea3d9a4eaaa8cef86b2a89f3660818117b33"
"reference": "5176f5abb38d3ea8a6e3ac6cd3bbb54d8185a689"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/2c6fea3d9a4eaaa8cef86b2a89f3660818117b33",
"reference": "2c6fea3d9a4eaaa8cef86b2a89f3660818117b33",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/5176f5abb38d3ea8a6e3ac6cd3bbb54d8185a689",
"reference": "5176f5abb38d3ea8a6e3ac6cd3bbb54d8185a689",
"shasum": ""
},
"require": {
@ -84,13 +85,17 @@
"php": ">=5.4.0"
},
"require-dev": {
"nikic/php-parser": "^2.0"
"nikic/php-parser": "^2.0|^3.0",
"phpunit/phpunit": "^4|^5"
},
"bin": [
"bin/generate-defuse-key"
],
"type": "library",
"autoload": {
"classmap": [
"src"
]
"psr-4": {
"Defuse\\Crypto\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -121,7 +126,7 @@
"security",
"symmetric key cryptography"
],
"time": "2016-10-10T15:20:26+00:00"
"time": "2017-05-18T21:28:48+00:00"
},
{
"name": "fig/link-util",
@ -225,12 +230,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/application.git",
"reference": "d0cbbe087f11138e3ced5b12d0bf91e84cc8d7cb"
"reference": "61c9b006576630c133c72f4e7ddd0166f5602baf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/application/zipball/d0cbbe087f11138e3ced5b12d0bf91e84cc8d7cb",
"reference": "d0cbbe087f11138e3ced5b12d0bf91e84cc8d7cb",
"url": "https://api.github.com/repos/joomla-framework/application/zipball/61c9b006576630c133c72f4e7ddd0166f5602baf",
"reference": "61c9b006576630c133c72f4e7ddd0166f5602baf",
"shasum": ""
},
"require": {
@ -275,7 +280,7 @@
"framework",
"joomla"
],
"time": "2017-05-29T11:04:58+00:00"
"time": "2017-06-20 02:25:07"
},
{
"name": "joomla/compat",
@ -320,12 +325,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/controller.git",
"reference": "441b110abd0c088fef356dd8dcb60cecd93e1f60"
"reference": "02fde4b9ea9350f6082b11fab11d1036f1135720"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/controller/zipball/441b110abd0c088fef356dd8dcb60cecd93e1f60",
"reference": "441b110abd0c088fef356dd8dcb60cecd93e1f60",
"url": "https://api.github.com/repos/joomla-framework/controller/zipball/02fde4b9ea9350f6082b11fab11d1036f1135720",
"reference": "02fde4b9ea9350f6082b11fab11d1036f1135720",
"shasum": ""
},
"require": {
@ -363,7 +368,7 @@
"framework",
"joomla"
],
"time": "2017-02-19T22:01:31+00:00"
"time": "2017-05-27T01:07:02+00:00"
},
{
"name": "joomla/crypt",
@ -371,12 +376,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/crypt.git",
"reference": "9d3bb73cec9c3c58bcac214bad3d71c6097bbdee"
"reference": "88dcee0e0bc0cd44e3e74bc19382b018a4297f34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/crypt/zipball/9d3bb73cec9c3c58bcac214bad3d71c6097bbdee",
"reference": "9d3bb73cec9c3c58bcac214bad3d71c6097bbdee",
"url": "https://api.github.com/repos/joomla-framework/crypt/zipball/88dcee0e0bc0cd44e3e74bc19382b018a4297f34",
"reference": "88dcee0e0bc0cd44e3e74bc19382b018a4297f34",
"shasum": ""
},
"require": {
@ -412,7 +417,7 @@
"framework",
"joomla"
],
"time": "2017-05-27T01:08:36+00:00"
"time": "2017-06-23T02:05:02+00:00"
},
{
"name": "joomla/data",
@ -420,12 +425,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/data.git",
"reference": "c01d8d9428d79121807cca75dbe3220bc5988ccb"
"reference": "6131c681cb6b00a4ed859eb337fd7106c4419fe3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/data/zipball/c01d8d9428d79121807cca75dbe3220bc5988ccb",
"reference": "c01d8d9428d79121807cca75dbe3220bc5988ccb",
"url": "https://api.github.com/repos/joomla-framework/data/zipball/6131c681cb6b00a4ed859eb337fd7106c4419fe3",
"reference": "6131c681cb6b00a4ed859eb337fd7106c4419fe3",
"shasum": ""
},
"require": {
@ -460,7 +465,7 @@
"framework",
"joomla"
],
"time": "2017-05-27T01:08:49+00:00"
"time": "2017-06-23 02:45:48"
},
{
"name": "joomla/database",
@ -468,12 +473,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/database.git",
"reference": "a96ebad17c104412f086b1479826a5d226ff29fb"
"reference": "a6432c6f30a14f275b871373b5e7a8e0c1388b9d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/database/zipball/a96ebad17c104412f086b1479826a5d226ff29fb",
"reference": "a96ebad17c104412f086b1479826a5d226ff29fb",
"url": "https://api.github.com/repos/joomla-framework/database/zipball/a6432c6f30a14f275b871373b5e7a8e0c1388b9d",
"reference": "a6432c6f30a14f275b871373b5e7a8e0c1388b9d",
"shasum": ""
},
"require": {
@ -519,7 +524,7 @@
"framework",
"joomla"
],
"time": "2017-06-23T19:02:37+00:00"
"time": "2017-06-28T23:24:47+00:00"
},
{
"name": "joomla/di",
@ -527,12 +532,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/di.git",
"reference": "723747e57bb57c93d1b23f66ab6b8396f49eefd2"
"reference": "db5553244d6523e8c776ead8172b449de48674cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/di/zipball/723747e57bb57c93d1b23f66ab6b8396f49eefd2",
"reference": "723747e57bb57c93d1b23f66ab6b8396f49eefd2",
"url": "https://api.github.com/repos/joomla-framework/di/zipball/db5553244d6523e8c776ead8172b449de48674cd",
"reference": "db5553244d6523e8c776ead8172b449de48674cd",
"shasum": ""
},
"require": {
@ -571,7 +576,7 @@
"ioc",
"joomla"
],
"time": "2017-05-27T01:09:57+00:00"
"time": "2017-06-28T22:59:46+00:00"
},
{
"name": "joomla/event",
@ -1005,7 +1010,7 @@
"joomla",
"registry"
],
"time": "2017-05-27T01:17:43+00:00"
"time": "2017-05-27 01:17:43"
},
{
"name": "joomla/session",
@ -1013,12 +1018,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/session.git",
"reference": "73f24b57ec1a34ecca2d4aa98beaf1af36d06a12"
"reference": "c5b16c184a9917d70fd8475a4adadfe4a47a2aed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/session/zipball/73f24b57ec1a34ecca2d4aa98beaf1af36d06a12",
"reference": "73f24b57ec1a34ecca2d4aa98beaf1af36d06a12",
"url": "https://api.github.com/repos/joomla-framework/session/zipball/c5b16c184a9917d70fd8475a4adadfe4a47a2aed",
"reference": "c5b16c184a9917d70fd8475a4adadfe4a47a2aed",
"shasum": ""
},
"require": {
@ -1069,7 +1074,7 @@
"joomla",
"session"
],
"time": "2017-05-27T01:20:50+00:00"
"time": "2017-06-01T16:00:13+00:00"
},
{
"name": "joomla/string",
@ -1143,12 +1148,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-framework/uri.git",
"reference": "c4c0db28f8d007ba5126ba6bcbabbfb7904be30b"
"reference": "0bb88f26235254a6e70a02b0e4c50fafd7379019"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-framework/uri/zipball/c4c0db28f8d007ba5126ba6bcbabbfb7904be30b",
"reference": "c4c0db28f8d007ba5126ba6bcbabbfb7904be30b",
"url": "https://api.github.com/repos/joomla-framework/uri/zipball/0bb88f26235254a6e70a02b0e4c50fafd7379019",
"reference": "0bb88f26235254a6e70a02b0e4c50fafd7379019",
"shasum": ""
},
"require": {
@ -1181,7 +1186,7 @@
"joomla",
"uri"
],
"time": "2017-05-27T01:23:06+00:00"
"time": "2017-06-28T23:33:08+00:00"
},
{
"name": "joomla/utilities",
@ -1231,16 +1236,16 @@
},
{
"name": "paragonie/random_compat",
"version": "v2.0.4",
"version": "v2.0.10",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
"reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d",
"reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d",
"shasum": ""
},
"require": {
@ -1275,20 +1280,20 @@
"pseudorandom",
"random"
],
"time": "2016-11-07T23:38:38+00:00"
"time": "2017-03-13T16:27:32+00:00"
},
{
"name": "phpmailer/phpmailer",
"version": "v6.0.0rc4",
"version": "v6.0.0rc5",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "2963f2b2945610cc0c1a6b8a1714602cdd7299a2"
"reference": "9c3ba23563a54f9318bb2e4748db45e0c4cd96c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2963f2b2945610cc0c1a6b8a1714602cdd7299a2",
"reference": "2963f2b2945610cc0c1a6b8a1714602cdd7299a2",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/9c3ba23563a54f9318bb2e4748db45e0c4cd96c6",
"reference": "9c3ba23563a54f9318bb2e4748db45e0c4cd96c6",
"shasum": ""
},
"require": {
@ -1334,7 +1339,7 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2017-01-09T10:18:14+00:00"
"time": "2017-02-28T10:46:22+00:00"
},
{
"name": "psr/container",
@ -1533,16 +1538,16 @@
},
{
"name": "symfony/polyfill-php56",
"version": "v1.3.0",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php56.git",
"reference": "1dd42b9b89556f18092f3d1ada22cb05ac85383c"
"reference": "bc0b7d6cb36b10cfabb170a3e359944a95174929"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/1dd42b9b89556f18092f3d1ada22cb05ac85383c",
"reference": "1dd42b9b89556f18092f3d1ada22cb05ac85383c",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/bc0b7d6cb36b10cfabb170a3e359944a95174929",
"reference": "bc0b7d6cb36b10cfabb170a3e359944a95174929",
"shasum": ""
},
"require": {
@ -1552,7 +1557,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-master": "1.4-dev"
}
},
"autoload": {
@ -1585,20 +1590,20 @@
"portable",
"shim"
],
"time": "2016-11-14T01:06:16+00:00"
"time": "2017-06-09T08:25:21+00:00"
},
{
"name": "symfony/polyfill-util",
"version": "v1.3.0",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-util.git",
"reference": "746bce0fca664ac0a575e465f65c6643faddf7fb"
"reference": "ebccbde4aad410f6438d86d7d261c6b4d2b9a51d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/746bce0fca664ac0a575e465f65c6643faddf7fb",
"reference": "746bce0fca664ac0a575e465f65c6643faddf7fb",
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ebccbde4aad410f6438d86d7d261c6b4d2b9a51d",
"reference": "ebccbde4aad410f6438d86d7d261c6b4d2b9a51d",
"shasum": ""
},
"require": {
@ -1607,7 +1612,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-master": "1.4-dev"
}
},
"autoload": {
@ -1637,7 +1642,7 @@
"polyfill",
"shim"
],
"time": "2016-11-14T01:06:16+00:00"
"time": "2017-06-09T08:25:21+00:00"
},
{
"name": "symfony/web-link",
@ -1712,16 +1717,16 @@
},
{
"name": "symfony/yaml",
"version": "v2.8.17",
"version": "v2.8.22",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "322a8c2dfbca15ad6b1b27e182899f98ec0e0153"
"reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/322a8c2dfbca15ad6b1b27e182899f98ec0e0153",
"reference": "322a8c2dfbca15ad6b1b27e182899f98ec0e0153",
"url": "https://api.github.com/repos/symfony/yaml/zipball/4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5",
"reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5",
"shasum": ""
},
"require": {
@ -1757,20 +1762,20 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-01-21T16:40:50+00:00"
"time": "2017-06-01T20:52:29+00:00"
},
{
"name": "zendframework/zend-diactoros",
"version": "1.3.10",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "83e8d98b9915de76c659ce27d683c02a0f99fa90"
"reference": "b03f285a333f51e58c95cce54109a4a9ed691436"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/83e8d98b9915de76c659ce27d683c02a0f99fa90",
"reference": "83e8d98b9915de76c659ce27d683c02a0f99fa90",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/b03f285a333f51e58c95cce54109a4a9ed691436",
"reference": "b03f285a333f51e58c95cce54109a4a9ed691436",
"shasum": ""
},
"require": {
@ -1778,17 +1783,19 @@
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "~1.0.0"
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"ext-dom": "*",
"ext-libxml": "*",
"phpunit/phpunit": "^4.6 || ^5.5",
"zendframework/zend-coding-standard": "~1.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev",
"dev-develop": "1.4-dev"
"dev-master": "1.4-dev",
"dev-develop": "1.5-dev"
}
},
"autoload": {
@ -1807,7 +1814,7 @@
"psr",
"psr-7"
],
"time": "2017-01-23T04:53:24+00:00"
"time": "2017-04-06T16:18:34+00:00"
}
],
"packages-dev": [
@ -2540,16 +2547,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.8.35",
"version": "4.8.36",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87"
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87",
"reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517",
"reference": "46023de9a91eec7dfb06cc56cb4e260017298517",
"shasum": ""
},
"require": {
@ -2608,7 +2615,7 @@
"testing",
"xunit"
],
"time": "2017-02-06T05:18:07+00:00"
"time": "2017-06-21T08:07:12+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -2732,23 +2739,23 @@
},
{
"name": "sebastian/diff",
"version": "1.4.1",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"type": "library",
"extra": {
@ -2780,7 +2787,7 @@
"keywords": [
"diff"
],
"time": "2015-12-08T07:14:41+00:00"
"time": "2017-05-22T07:24:03+00:00"
},
{
"name": "sebastian/environment",
@ -3115,16 +3122,16 @@
},
{
"name": "symfony/console",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870"
"reference": "70d2a29b2911cbdc91a7e268046c395278238b2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/0e5e6899f82230fcb1153bcaf0e106ffaa44b870",
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870",
"url": "https://api.github.com/repos/symfony/console/zipball/70d2a29b2911cbdc91a7e268046c395278238b2e",
"reference": "70d2a29b2911cbdc91a7e268046c395278238b2e",
"shasum": ""
},
"require": {
@ -3132,10 +3139,16 @@
"symfony/debug": "~2.8|~3.0",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.3",
"symfony/dependency-injection": "~3.3",
"symfony/event-dispatcher": "~2.8|~3.0",
"symfony/filesystem": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0"
},
"suggest": {
@ -3147,7 +3160,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3174,20 +3187,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-02-16T14:07:22+00:00"
"time": "2017-06-02T19:24:58+00:00"
},
{
"name": "symfony/debug",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9"
"reference": "e9c50482841ef696e8fa1470d950a79c8921f45d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/9b98854cb45bc59d100b7d4cc4cf9e05f21026b9",
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9",
"url": "https://api.github.com/repos/symfony/debug/zipball/e9c50482841ef696e8fa1470d950a79c8921f45d",
"reference": "e9c50482841ef696e8fa1470d950a79c8921f45d",
"shasum": ""
},
"require": {
@ -3198,13 +3211,12 @@
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3231,29 +3243,32 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-02-16T16:34:18+00:00"
"time": "2017-06-01T21:01:25+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "9137eb3a3328e413212826d63eeeb0217836e2b6"
"reference": "4054a102470665451108f9b59305c79176ef98f0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9137eb3a3328e413212826d63eeeb0217836e2b6",
"reference": "9137eb3a3328e413212826d63eeeb0217836e2b6",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4054a102470665451108f9b59305c79176ef98f0",
"reference": "4054a102470665451108f9b59305c79176ef98f0",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"conflict": {
"symfony/dependency-injection": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~2.8|~3.0",
"symfony/dependency-injection": "~2.8|~3.0",
"symfony/dependency-injection": "~3.3",
"symfony/expression-language": "~2.8|~3.0",
"symfony/stopwatch": "~2.8|~3.0"
},
@ -3264,7 +3279,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3291,20 +3306,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00"
"time": "2017-06-04T18:15:29+00:00"
},
{
"name": "symfony/filesystem",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4"
"reference": "c709670bf64721202ddbe4162846f250735842c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4",
"reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/c709670bf64721202ddbe4162846f250735842c0",
"reference": "c709670bf64721202ddbe4162846f250735842c0",
"shasum": ""
},
"require": {
@ -3313,7 +3328,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3340,20 +3355,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2017-01-08T20:47:33+00:00"
"time": "2017-05-28T14:08:56+00:00"
},
{
"name": "symfony/finder",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6"
"reference": "baea7f66d30854ad32988c11a09d7ffd485810c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6",
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6",
"url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4",
"reference": "baea7f66d30854ad32988c11a09d7ffd485810c4",
"shasum": ""
},
"require": {
@ -3362,7 +3377,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3389,20 +3404,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00"
"time": "2017-06-01T21:01:25+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
"reference": "f29dca382a6485c3cbe6379f0c61230167681937"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937",
"reference": "f29dca382a6485c3cbe6379f0c61230167681937",
"shasum": ""
},
"require": {
@ -3414,7 +3429,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-master": "1.4-dev"
}
},
"autoload": {
@ -3448,20 +3463,20 @@
"portable",
"shim"
],
"time": "2016-11-14T01:06:16+00:00"
"time": "2017-06-09T14:24:12+00:00"
},
{
"name": "symfony/process",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856"
"reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856",
"reference": "0ab87c1e7570b3534a6e51eb4ca8e9f6d7327856",
"url": "https://api.github.com/repos/symfony/process/zipball/8e30690c67aafb6c7992d6d8eb0d707807dd3eaf",
"reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf",
"shasum": ""
},
"require": {
@ -3470,7 +3485,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3497,20 +3512,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2017-02-16T14:07:22+00:00"
"time": "2017-05-22T12:32:03+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v3.2.4",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "9aa0b51889c01bca474853ef76e9394b02264464"
"reference": "602a15299dc01556013b07167d4f5d3a60e90d15"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/9aa0b51889c01bca474853ef76e9394b02264464",
"reference": "9aa0b51889c01bca474853ef76e9394b02264464",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/602a15299dc01556013b07167d4f5d3a60e90d15",
"reference": "602a15299dc01556013b07167d4f5d3a60e90d15",
"shasum": ""
},
"require": {
@ -3519,7 +3534,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -3546,7 +3561,7 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00"
"time": "2017-04-12T14:14:56+00:00"
},
{
"name": "webmozart/assert",

View File

@ -7,19 +7,5 @@ $baseDir = dirname(dirname($vendorDir));
return array(
'CallbackFilterIterator' => $vendorDir . '/joomla/compat/src/CallbackFilterIterator.php',
'Defuse\\Crypto\\Core' => $vendorDir . '/defuse/php-encryption/src/Core.php',
'Defuse\\Crypto\\Crypto' => $vendorDir . '/defuse/php-encryption/src/Crypto.php',
'Defuse\\Crypto\\DerivedKeys' => $vendorDir . '/defuse/php-encryption/src/DerivedKeys.php',
'Defuse\\Crypto\\Encoding' => $vendorDir . '/defuse/php-encryption/src/Encoding.php',
'Defuse\\Crypto\\Exception\\BadFormatException' => $vendorDir . '/defuse/php-encryption/src/Exception/BadFormatException.php',
'Defuse\\Crypto\\Exception\\CryptoException' => $vendorDir . '/defuse/php-encryption/src/Exception/CryptoException.php',
'Defuse\\Crypto\\Exception\\EnvironmentIsBrokenException' => $vendorDir . '/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php',
'Defuse\\Crypto\\Exception\\IOException' => $vendorDir . '/defuse/php-encryption/src/Exception/IOException.php',
'Defuse\\Crypto\\Exception\\WrongKeyOrModifiedCiphertextException' => $vendorDir . '/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php',
'Defuse\\Crypto\\File' => $vendorDir . '/defuse/php-encryption/src/File.php',
'Defuse\\Crypto\\Key' => $vendorDir . '/defuse/php-encryption/src/Key.php',
'Defuse\\Crypto\\KeyOrPassword' => $vendorDir . '/defuse/php-encryption/src/KeyOrPassword.php',
'Defuse\\Crypto\\KeyProtectedByPassword' => $vendorDir . '/defuse/php-encryption/src/KeyProtectedByPassword.php',
'Defuse\\Crypto\\RuntimeTests' => $vendorDir . '/defuse/php-encryption/src/RuntimeTests.php',
'JsonSerializable' => $vendorDir . '/joomla/compat/src/JsonSerializable.php',
);

View File

@ -39,5 +39,6 @@ return array(
'Joomla\\Application\\' => array($vendorDir . '/joomla/application/src'),
'Joomla\\' => array($baseDir . '/libraries/src'),
'Fig\\Link\\' => array($vendorDir . '/fig/link-util/src'),
'Defuse\\Crypto\\' => array($vendorDir . '/defuse/php-encryption/src'),
'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
);

View File

@ -76,6 +76,10 @@ class ComposerStaticInit423c8facdf90155590c7b49e979f3a1e
array (
'Fig\\Link\\' => 9,
),
'D' =>
array (
'Defuse\\Crypto\\' => 14,
),
'C' =>
array (
'Composer\\CaBundle\\' => 18,
@ -215,6 +219,10 @@ class ComposerStaticInit423c8facdf90155590c7b49e979f3a1e
array (
0 => __DIR__ . '/..' . '/fig/link-util/src',
),
'Defuse\\Crypto\\' =>
array (
0 => __DIR__ . '/..' . '/defuse/php-encryption/src',
),
'Composer\\CaBundle\\' =>
array (
0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
@ -223,20 +231,6 @@ class ComposerStaticInit423c8facdf90155590c7b49e979f3a1e
public static $classMap = array (
'CallbackFilterIterator' => __DIR__ . '/..' . '/joomla/compat/src/CallbackFilterIterator.php',
'Defuse\\Crypto\\Core' => __DIR__ . '/..' . '/defuse/php-encryption/src/Core.php',
'Defuse\\Crypto\\Crypto' => __DIR__ . '/..' . '/defuse/php-encryption/src/Crypto.php',
'Defuse\\Crypto\\DerivedKeys' => __DIR__ . '/..' . '/defuse/php-encryption/src/DerivedKeys.php',
'Defuse\\Crypto\\Encoding' => __DIR__ . '/..' . '/defuse/php-encryption/src/Encoding.php',
'Defuse\\Crypto\\Exception\\BadFormatException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/BadFormatException.php',
'Defuse\\Crypto\\Exception\\CryptoException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/CryptoException.php',
'Defuse\\Crypto\\Exception\\EnvironmentIsBrokenException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php',
'Defuse\\Crypto\\Exception\\IOException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/IOException.php',
'Defuse\\Crypto\\Exception\\WrongKeyOrModifiedCiphertextException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php',
'Defuse\\Crypto\\File' => __DIR__ . '/..' . '/defuse/php-encryption/src/File.php',
'Defuse\\Crypto\\Key' => __DIR__ . '/..' . '/defuse/php-encryption/src/Key.php',
'Defuse\\Crypto\\KeyOrPassword' => __DIR__ . '/..' . '/defuse/php-encryption/src/KeyOrPassword.php',
'Defuse\\Crypto\\KeyProtectedByPassword' => __DIR__ . '/..' . '/defuse/php-encryption/src/KeyProtectedByPassword.php',
'Defuse\\Crypto\\RuntimeTests' => __DIR__ . '/..' . '/defuse/php-encryption/src/RuntimeTests.php',
'JsonSerializable' => __DIR__ . '/..' . '/joomla/compat/src/JsonSerializable.php',
);

View File

@ -1,7 +1,7 @@
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Wed Nov 2 04:12:05 2016 GMT
## Certificate data from Mozilla as of: Wed Jan 18 04:12:05 2017 GMT
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
@ -14,28 +14,9 @@
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl version 1.27.
## SHA256: 17e2a90c8a5cfd6a675b3475d3d467e1ab1fe0d5397e907b08206182389caa08
## SHA256: dffa79e6aa993f558e82884abf7bb54bf440ab66ee91d82a27a627f6f2a4ace4
##
Equifax Secure CA
=================
-----BEGIN CERTIFICATE-----
MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
70+sB3c4
-----END CERTIFICATE-----
GlobalSign Root CA
==================
@ -271,27 +252,6 @@ W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
-----END CERTIFICATE-----
RSA Security 2048 v3
====================
-----BEGIN CERTIFICATE-----
MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
pKnXwiJPZ9d37CAFYd4=
-----END CERTIFICATE-----
GeoTrust Global CA
==================
-----BEGIN CERTIFICATE-----
@ -1304,30 +1264,6 @@ FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
-----END CERTIFICATE-----
IGC/A
=====
-----BEGIN CERTIFICATE-----
MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
0mBWWg==
-----END CERTIFICATE-----
Security Communication EV RootCA1
=================================
-----BEGIN CERTIFICATE-----
@ -1537,58 +1473,6 @@ LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
-----END CERTIFICATE-----
Buypass Class 2 CA 1
====================
-----BEGIN CERTIFICATE-----
MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
-----END CERTIFICATE-----
EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
==========================================================================
-----BEGIN CERTIFICATE-----
MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
-----END CERTIFICATE-----
certSIGN ROOT CA
================
-----BEGIN CERTIFICATE-----
@ -1838,34 +1722,6 @@ IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
66+KAQ==
-----END CERTIFICATE-----
Juur-SK
=======
-----BEGIN CERTIFICATE-----
MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
+Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
yyqcjg==
-----END CERTIFICATE-----
Hongkong Post Root CA 1
=======================
-----BEGIN CERTIFICATE-----
@ -2329,41 +2185,6 @@ wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
vgt2Fl43N+bYdJeimUV5
-----END CERTIFICATE-----
Root CA Generalitat Valenciana
==============================
-----BEGIN CERTIFICATE-----
MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
+GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
-----END CERTIFICATE-----
TWCA Root Certification Authority
=================================
-----BEGIN CERTIFICATE-----
@ -4083,3 +3904,140 @@ YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----
AC RAIZ FNMT-RCM
================
-----BEGIN CERTIFICATE-----
MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
+YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
-----END CERTIFICATE-----
Amazon Root CA 1
================
-----BEGIN CERTIFICATE-----
MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
-----END CERTIFICATE-----
Amazon Root CA 2
================
-----BEGIN CERTIFICATE-----
MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
+gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
-----END CERTIFICATE-----
Amazon Root CA 3
================
-----BEGIN CERTIFICATE-----
MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
-----END CERTIFICATE-----
Amazon Root CA 4
================
-----BEGIN CERTIFICATE-----
MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
/sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
-----END CERTIFICATE-----
LuxTrust Global Root 2
======================
-----BEGIN CERTIFICATE-----
MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
/zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
+Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
/f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
-----END CERTIFICATE-----

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
#!/usr/bin/env php
<?php
use Defuse\Crypto\Key;
foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
if (file_exists($file)) {
require $file;
break;
}
}
$key = Key::createNewRandomKey();
echo $key->saveToAsciiSafeString(), "\n";

View File

@ -124,11 +124,20 @@ final class Core
* @param string $salt
*
* @throws Ex\EnvironmentIsBrokenException
* @psalm-suppress UndefinedFunction - We're checking if the function exists first.
*
* @return string
*/
public static function HKDF($hash, $ikm, $length, $info = '', $salt = null)
{
static $nativeHKDF = null;
if ($nativeHKDF === null) {
$nativeHKDF = \is_callable('\\hash_hkdf');
}
if ($nativeHKDF) {
return \hash_hkdf($hash, $ikm, $length, $info, $salt);
}
$digest_length = Core::ourStrlen(\hash_hmac($hash, '', '', true));
// Sanity-check the desired output length.
@ -172,8 +181,9 @@ final class Core
}
// ORM = first L octets of T
/** @var string $orm */
$orm = Core::ourSubstr($t, 0, $length);
if ($orm === false) {
if (!\is_string($orm)) {
throw new Ex\EnvironmentIsBrokenException();
}
return $orm;
@ -222,6 +232,7 @@ final class Core
* Throws an exception if the constant doesn't exist.
*
* @param string $name
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
*/
@ -236,6 +247,7 @@ final class Core
* Throws an exception if the function doesn't exist.
*
* @param string $name
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
*/
@ -287,7 +299,7 @@ final class Core
*
* @throws Ex\EnvironmentIsBrokenException
*
* @return string
* @return string|bool
*/
public static function ourSubstr($str, $start, $length = null)
{
@ -426,9 +438,9 @@ final class Core
}
if ($raw_output) {
return Core::ourSubstr($output, 0, $key_length);
return (string) Core::ourSubstr($output, 0, $key_length);
} else {
return Encoding::binToHex(Core::ourSubstr($output, 0, $key_length));
return Encoding::binToHex((string) Core::ourSubstr($output, 0, $key_length));
}
}
}

View File

@ -111,12 +111,18 @@ class Crypto
'Ciphertext is too short.'
);
}
/**
* @var string
*/
$hmac = Core::ourSubstr($ciphertext, 0, Core::LEGACY_MAC_BYTE_SIZE);
if ($hmac === false) {
if (!\is_string($hmac)) {
throw new Ex\EnvironmentIsBrokenException();
}
/**
* @var string
*/
$ciphertext = Core::ourSubstr($ciphertext, Core::LEGACY_MAC_BYTE_SIZE);
if ($ciphertext === false) {
if (!\is_string($ciphertext)) {
throw new Ex\EnvironmentIsBrokenException();
}
@ -145,17 +151,24 @@ class Crypto
'Ciphertext is too short.'
);
}
/**
* @var string
*/
$iv = Core::ourSubstr($ciphertext, 0, Core::LEGACY_BLOCK_BYTE_SIZE);
if ($iv === false) {
if (!\is_string($iv)) {
throw new Ex\EnvironmentIsBrokenException();
}
$ciphertext = Core::ourSubstr($ciphertext, Core::LEGACY_BLOCK_BYTE_SIZE);
if ($ciphertext === false) {
/**
* @var string
*/
$actualCiphertext = Core::ourSubstr($ciphertext, Core::LEGACY_BLOCK_BYTE_SIZE);
if (!\is_string($actualCiphertext)) {
throw new Ex\EnvironmentIsBrokenException();
}
// Do the decryption.
$plaintext = self::plainDecrypt($ciphertext, $ekey, $iv, Core::LEGACY_CIPHER_METHOD);
$plaintext = self::plainDecrypt($actualCiphertext, $ekey, $iv, Core::LEGACY_CIPHER_METHOD);
return $plaintext;
} else {
throw new Ex\WrongKeyOrModifiedCiphertextException(
@ -226,6 +239,7 @@ class Crypto
}
// Get and check the version header.
/** @var string $header */
$header = Core::ourSubstr($ciphertext, 0, Core::HEADER_VERSION_SIZE);
if ($header !== Core::CURRENT_VERSION) {
throw new Ex\WrongKeyOrModifiedCiphertextException(
@ -234,36 +248,40 @@ class Crypto
}
// Get the salt.
/** @var string $salt */
$salt = Core::ourSubstr(
$ciphertext,
Core::HEADER_VERSION_SIZE,
Core::SALT_BYTE_SIZE
);
if ($salt === false) {
if (!\is_string($salt)) {
throw new Ex\EnvironmentIsBrokenException();
}
// Get the IV.
/** @var string $iv */
$iv = Core::ourSubstr(
$ciphertext,
Core::HEADER_VERSION_SIZE + Core::SALT_BYTE_SIZE,
Core::BLOCK_BYTE_SIZE
);
if ($iv === false) {
if (!\is_string($iv)) {
throw new Ex\EnvironmentIsBrokenException();
}
// Get the HMAC.
/** @var string $hmac */
$hmac = Core::ourSubstr(
$ciphertext,
Core::ourStrlen($ciphertext) - Core::MAC_BYTE_SIZE,
Core::MAC_BYTE_SIZE
);
if ($hmac === false) {
if (!\is_string($hmac)) {
throw new Ex\EnvironmentIsBrokenException();
}
// Get the actual encrypted ciphertext.
/** @var string $encrypted */
$encrypted = Core::ourSubstr(
$ciphertext,
Core::HEADER_VERSION_SIZE + Core::SALT_BYTE_SIZE +
@ -271,7 +289,7 @@ class Crypto
Core::ourStrlen($ciphertext) - Core::MAC_BYTE_SIZE - Core::SALT_BYTE_SIZE -
Core::BLOCK_BYTE_SIZE - Core::HEADER_VERSION_SIZE
);
if ($encrypted === false) {
if (!\is_string($encrypted)) {
throw new Ex\EnvironmentIsBrokenException();
}
@ -304,6 +322,7 @@ class Crypto
{
Core::ensureConstantExists('OPENSSL_RAW_DATA');
Core::ensureFunctionExists('openssl_encrypt');
/** @var string $ciphertext */
$ciphertext = \openssl_encrypt(
$plaintext,
Core::CIPHER_METHOD,
@ -312,7 +331,7 @@ class Crypto
$iv
);
if ($ciphertext === false) {
if (!\is_string($ciphertext)) {
throw new Ex\EnvironmentIsBrokenException(
'openssl_encrypt() failed.'
);
@ -337,6 +356,8 @@ class Crypto
{
Core::ensureConstantExists('OPENSSL_RAW_DATA');
Core::ensureFunctionExists('openssl_decrypt');
/** @var string $plaintext */
$plaintext = \openssl_decrypt(
$ciphertext,
$cipherMethod,
@ -344,7 +365,7 @@ class Crypto
OPENSSL_RAW_DATA,
$iv
);
if ($plaintext === false) {
if (!\is_string($plaintext)) {
throw new Ex\EnvironmentIsBrokenException(
'openssl_decrypt() failed.'
);
@ -356,7 +377,7 @@ class Crypto
/**
* Verifies an HMAC without leaking information through side-channels.
*
* @param string $correct_hmac
* @param string $expected_hmac
* @param string $message
* @param string $key
*
@ -364,9 +385,9 @@ class Crypto
*
* @return bool
*/
protected static function verifyHMAC($correct_hmac, $message, $key)
protected static function verifyHMAC($expected_hmac, $message, $key)
{
$message_hmac = \hash_hmac(Core::HASH_FUNCTION_NAME, $message, $key, true);
return Core::hashEquals($correct_hmac, $message_hmac);
return Core::hashEquals($message_hmac, $expected_hmac);
}
}

View File

@ -2,13 +2,25 @@
namespace Defuse\Crypto;
/**
* Class DerivedKeys
* @package Defuse\Crypto
*/
final class DerivedKeys
{
private $akey = null;
private $ekey = null;
/**
* @var string
*/
private $akey = '';
/**
* @var string
*/
private $ekey = '';
/**
* Returns the authentication key.
* @return string
*/
public function getAuthenticationKey()
{
@ -17,6 +29,7 @@ final class DerivedKeys
/**
* Returns the encryption key.
* @return string
*/
public function getEncryptionKey()
{

View File

@ -77,6 +77,62 @@ final class Encoding
}
return $bin;
}
/**
* Remove trialing whitespace without table look-ups or branches.
*
* Calling this function may leak the length of the string as well as the
* number of trailing whitespace characters through side-channels.
*
* @param string $string
* @return string
*/
public static function trimTrailingWhitespace($string = '')
{
$length = Core::ourStrlen($string);
if ($length < 1) {
return '';
}
do {
$prevLength = $length;
$last = $length - 1;
$chr = \ord($string[$last]);
/* Null Byte (0x00), a.k.a. \0 */
// if ($chr === 0x00) $length -= 1;
$sub = (($chr - 1) >> 8 ) & 1;
$length -= $sub;
$last -= $sub;
/* Horizontal Tab (0x09) a.k.a. \t */
$chr = \ord($string[$last]);
// if ($chr === 0x09) $length -= 1;
$sub = (((0x08 - $chr) & ($chr - 0x0a)) >> 8) & 1;
$length -= $sub;
$last -= $sub;
/* New Line (0x0a), a.k.a. \n */
$chr = \ord($string[$last]);
// if ($chr === 0x0a) $length -= 1;
$sub = (((0x09 - $chr) & ($chr - 0x0b)) >> 8) & 1;
$length -= $sub;
$last -= $sub;
/* Carriage Return (0x0D), a.k.a. \r */
$chr = \ord($string[$last]);
// if ($chr === 0x0d) $length -= 1;
$sub = (((0x0c - $chr) & ($chr - 0x0e)) >> 8) & 1;
$length -= $sub;
$last -= $sub;
/* Space */
$chr = \ord($string[$last]);
// if ($chr === 0x20) $length -= 1;
$sub = (((0x1f - $chr) & ($chr - 0x21)) >> 8) & 1;
$length -= $sub;
} while ($prevLength !== $length && $length > 0);
return (string) Core::ourSubstr($string, 0, $length);
}
/*
* SECURITY NOTE ON APPLYING CHECKSUMS TO SECRETS:
@ -161,6 +217,8 @@ final class Encoding
);
}
/* If you get an exception here when attempting to load from a file, first pass your
key to Encoding::trimTrailingWhitespace() to remove newline characters, etc. */
$bytes = Encoding::hexToBin($string);
/* Make sure we have enough bytes to get the version header and checksum. */
@ -171,7 +229,7 @@ final class Encoding
}
/* Grab the version header. */
$actual_header = Core::ourSubstr($bytes, 0, self::SERIALIZE_HEADER_BYTES);
$actual_header = (string) Core::ourSubstr($bytes, 0, self::SERIALIZE_HEADER_BYTES);
if ($actual_header !== $expected_header) {
throw new Ex\BadFormatException(
@ -180,14 +238,14 @@ final class Encoding
}
/* Grab the bytes that are part of the checksum. */
$checked_bytes = Core::ourSubstr(
$checked_bytes = (string) Core::ourSubstr(
$bytes,
0,
Core::ourStrlen($bytes) - self::CHECKSUM_BYTE_SIZE
);
/* Grab the included checksum. */
$checksum_a = Core::ourSubstr(
$checksum_a = (string) Core::ourSubstr(
$bytes,
Core::ourStrlen($bytes) - self::CHECKSUM_BYTE_SIZE,
self::CHECKSUM_BYTE_SIZE
@ -203,7 +261,7 @@ final class Encoding
);
}
return Core::ourSubstr(
return (string) Core::ourSubstr(
$bytes,
self::SERIALIZE_HEADER_BYTES,
Core::ourStrlen($bytes) - self::SERIALIZE_HEADER_BYTES - self::CHECKSUM_BYTE_SIZE

View File

@ -12,6 +12,7 @@ final class File
* @param string $inputFilename
* @param string $outputFilename
* @param Key $key
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -32,6 +33,7 @@ final class File
* @param string $inputFilename
* @param string $outputFilename
* @param string $password
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -51,6 +53,7 @@ final class File
* @param string $inputFilename
* @param string $outputFilename
* @param Key $key
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -72,6 +75,7 @@ final class File
* @param string $inputFilename
* @param string $outputFilename
* @param string $password
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -93,6 +97,7 @@ final class File
* @param resource $inputHandle
* @param resource $outputHandle
* @param Key $key
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\WrongKeyOrModifiedCiphertextException
@ -114,6 +119,7 @@ final class File
* @param resource $inputHandle
* @param resource $outputHandle
* @param string $password
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -135,6 +141,7 @@ final class File
* @param resource $inputHandle
* @param resource $outputHandle
* @param Key $key
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -156,6 +163,7 @@ final class File
* @param resource $inputHandle
* @param resource $outputHandle
* @param string $password
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -176,6 +184,7 @@ final class File
* @param string $inputFilename
* @param string $outputFilename
* @param KeyOrPassword $secret
* @return void
*
* @throws Ex\CryptoException
* @throws Ex\IOException
@ -240,6 +249,7 @@ final class File
* @param string $inputFilename
* @param string $outputFilename
* @param KeyOrPassword $secret
* @return void
*
* @throws Ex\CryptoException
* @throws Ex\IOException
@ -254,7 +264,7 @@ final class File
self::getLastErrorMessage()
);
}
if (\is_callable('\\stream_set_read_buffer')) {
/* This call can fail, but the only consequence is performance. */
\stream_set_read_buffer($if, 0);
@ -269,7 +279,7 @@ final class File
self::getLastErrorMessage()
);
}
if (\is_callable('\\stream_set_write_buffer')) {
/* This call can fail, but the only consequence is performance. */
\stream_set_write_buffer($of, 0);
@ -306,6 +316,7 @@ final class File
* @param resource $inputHandle
* @param resource $outputHandle
* @param KeyOrPassword $secret
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -335,8 +346,9 @@ final class File
$iv = Core::secureRandom($ivsize);
/* Initialize a streaming HMAC state. */
/** @var resource $hmac */
$hmac = \hash_init(Core::HASH_FUNCTION_NAME, HASH_HMAC, $akey);
if ($hmac === false) {
if (!\is_resource($hmac)) {
throw new Ex\EnvironmentIsBrokenException(
'Cannot initialize a hash context'
);
@ -358,14 +370,15 @@ final class File
$thisIv = $iv;
/* How many blocks do we encrypt at a time? We increment by this value. */
$inc = Core::BUFFER_BYTE_SIZE / Core::BLOCK_BYTE_SIZE;
$inc = (int) (Core::BUFFER_BYTE_SIZE / Core::BLOCK_BYTE_SIZE);
/* Loop until we reach the end of the input file. */
$at_file_end = false;
while (! (\feof($inputHandle) || $at_file_end)) {
/* Find out if we can read a full buffer, or only a partial one. */
/** @var int */
$pos = \ftell($inputHandle);
if ($pos === false) {
if (!\is_int($pos)) {
throw new Ex\IOException(
'Could not get current position in input file during encryption'
);
@ -385,6 +398,7 @@ final class File
}
/* Encrypt this buffer. */
/** @var string */
$encrypted = \openssl_encrypt(
$read,
Core::CIPHER_METHOD,
@ -393,7 +407,7 @@ final class File
$thisIv
);
if ($encrypted === false) {
if (!\is_string($encrypted)) {
throw new Ex\EnvironmentIsBrokenException(
'OpenSSL encryption error'
);
@ -422,6 +436,7 @@ final class File
* @param resource $inputHandle
* @param resource $outputHandle
* @param KeyOrPassword $secret
* @return void
*
* @throws Ex\EnvironmentIsBrokenException
* @throws Ex\IOException
@ -476,7 +491,7 @@ final class File
$thisIv = $iv;
/* How many blocks do we encrypt at a time? We increment by this value. */
$inc = Core::BUFFER_BYTE_SIZE / Core::BLOCK_BYTE_SIZE;
$inc = (int) (Core::BUFFER_BYTE_SIZE / Core::BLOCK_BYTE_SIZE);
/* Get the HMAC. */
if (\fseek($inputHandle, (-1 * Core::MAC_BYTE_SIZE), SEEK_END) === false) {
@ -486,8 +501,9 @@ final class File
}
/* Get the position of the last byte in the actual ciphertext. */
/** @var int $cipher_end */
$cipher_end = \ftell($inputHandle);
if ($cipher_end === false) {
if (!\is_int($cipher_end)) {
throw new Ex\IOException(
'Cannot read input file'
);
@ -496,11 +512,13 @@ final class File
--$cipher_end;
/* Read the HMAC. */
/** @var string $stored_mac */
$stored_mac = self::readBytes($inputHandle, Core::MAC_BYTE_SIZE);
/* Initialize a streaming HMAC state. */
/** @var resource $hmac */
$hmac = \hash_init(Core::HASH_FUNCTION_NAME, HASH_HMAC, $akey);
if ($hmac === false) {
if (!\is_resource($hmac)) {
throw new Ex\EnvironmentIsBrokenException(
'Cannot initialize a hash context'
);
@ -525,12 +543,14 @@ final class File
\hash_update($hmac, $header);
\hash_update($hmac, $file_salt);
\hash_update($hmac, $iv);
/** @var resource $hmac2 */
$hmac2 = \hash_copy($hmac);
$break = false;
while (! $break) {
/** @var int $pos */
$pos = \ftell($inputHandle);
if ($pos === false) {
if (!\is_int($pos)) {
throw new Ex\IOException(
'Could not get current position in input file during decryption'
);
@ -554,8 +574,9 @@ final class File
\hash_update($hmac, $read);
/* Remember this buffer-sized chunk's HMAC. */
/** @var resource $chunk_mac */
$chunk_mac = \hash_copy($hmac);
if ($chunk_mac === false) {
if (!\is_resource($chunk_mac)) {
throw new Ex\EnvironmentIsBrokenException(
'Cannot duplicate a hash context'
);
@ -564,6 +585,7 @@ final class File
}
/* Get the final HMAC, which should match the stored one. */
/** @var string $final_mac */
$final_mac = \hash_final($hmac, true);
/* Verify the HMAC. */
@ -584,8 +606,9 @@ final class File
$at_file_end = false;
while (! $at_file_end) {
/** @var int $pos */
$pos = \ftell($inputHandle);
if ($pos === false) {
if (!\is_int($pos)) {
throw new Ex\IOException(
'Could not get current position in input file during decryption'
);
@ -609,8 +632,9 @@ final class File
* remembered from pass #1 to ensure attackers didn't change the
* ciphertext after MAC verification. */
\hash_update($hmac2, $read);
/** @var resource $calc_mac */
$calc_mac = \hash_copy($hmac2);
if ($calc_mac === false) {
if (!\is_resource($calc_mac)) {
throw new Ex\EnvironmentIsBrokenException(
'Cannot duplicate a hash context'
);
@ -628,6 +652,7 @@ final class File
}
/* Decrypt this buffer-sized chunk. */
/** @var string $decrypted */
$decrypted = \openssl_decrypt(
$read,
Core::CIPHER_METHOD,
@ -635,7 +660,7 @@ final class File
OPENSSL_RAW_DATA,
$thisIv
);
if ($decrypted === false) {
if (!\is_string($decrypted)) {
throw new Ex\EnvironmentIsBrokenException(
'OpenSSL decryption error'
);
@ -649,6 +674,7 @@ final class File
);
/* Increment the IV by the amount of blocks in a buffer. */
/** @var string $thisIv */
$thisIv = Core::incrementCounter($thisIv, $inc);
/* WARNING: Usually, unless the file is a multiple of the buffer
* size, $thisIv will contain an incorrect value here on the last
@ -661,6 +687,7 @@ final class File
*
* @param resource $stream
* @param int $num_bytes
* @return string
*
* @throws Ex\IOException
* @throws Ex\EnvironmentIsBrokenException
@ -679,9 +706,9 @@ final class File
$buf = '';
$remaining = $num_bytes;
while ($remaining > 0 && ! \feof($stream)) {
/** @var string $read */
$read = \fread($stream, $remaining);
if ($read === false) {
if (!\is_string($read)) {
throw new Ex\IOException(
'Could not read from the file'
);
@ -703,6 +730,7 @@ final class File
* @param resource $stream
* @param string $buf
* @param int $num_bytes
* @return int
*
* @throws Ex\IOException
*
@ -726,13 +754,14 @@ final class File
}
$remaining = $num_bytes;
while ($remaining > 0) {
/** @var int $written */
$written = \fwrite($stream, $buf, $remaining);
if ($written === false) {
if (!\is_int($written)) {
throw new Ex\IOException(
'Could not write to the file'
);
}
$buf = Core::ourSubstr($buf, $written, null);
$buf = (string) Core::ourSubstr($buf, $written, null);
$remaining -= $written;
}
return $num_bytes;

View File

@ -9,7 +9,10 @@ final class Key
const KEY_CURRENT_VERSION = "\xDE\xF0\x00\x00";
const KEY_BYTE_SIZE = 32;
private $key_bytes = null;
/**
* @var string
*/
private $key_bytes;
/**
* Creates new random key.
@ -26,15 +29,23 @@ final class Key
/**
* Loads a Key from its encoded form.
*
* By default, this function will call Encoding::trimTrailingWhitespace()
* to remove trailing CR, LF, NUL, TAB, and SPACE characters, which are
* commonly appended to files when working with text editors.
*
* @param string $saved_key_string
* @param bool $do_not_trim (default: false)
*
* @throws Ex\BadFormatException
* @throws Ex\EnvironmentIsBrokenException
*
* @return Key
*/
public static function loadFromAsciiSafeString($saved_key_string)
public static function loadFromAsciiSafeString($saved_key_string, $do_not_trim = false)
{
if (!$do_not_trim) {
$saved_key_string = Encoding::trimTrailingWhitespace($saved_key_string);
}
$key_bytes = Encoding::loadBytesFromChecksummedAsciiSafeString(self::KEY_CURRENT_VERSION, $saved_key_string);
return new Key($key_bytes);
}

View File

@ -10,8 +10,15 @@ final class KeyOrPassword
const SECRET_TYPE_KEY = 1;
const SECRET_TYPE_PASSWORD = 2;
private $secret_type = null;
private $secret = null;
/**
* @var int
*/
private $secret_type = 0;
/**
* @var Key|string
*/
private $secret;
/**
* Initializes an instance of KeyOrPassword from a key.
@ -43,6 +50,7 @@ final class KeyOrPassword
*
* @param string $salt
*
* @throws Ex\CryptoException
* @throws Ex\EnvironmentIsBrokenException
*
* @return DerivedKeys
@ -54,6 +62,9 @@ final class KeyOrPassword
}
if ($this->secret_type === self::SECRET_TYPE_KEY) {
if (!($this->secret instanceof Key)) {
throw new Ex\CryptoException('Expected a Key object');
}
$akey = Core::HKDF(
Core::HASH_FUNCTION_NAME,
$this->secret->getRawBytes(),
@ -70,6 +81,9 @@ final class KeyOrPassword
);
return new DerivedKeys($akey, $ekey);
} elseif ($this->secret_type === self::SECRET_TYPE_PASSWORD) {
if (!\is_string($this->secret)) {
throw new Ex\CryptoException('Expected a string');
}
/* Our PBKDF2 polyfill is vulnerable to a DoS attack documented in
* GitHub issue #230. The fix is to pre-hash the password to ensure
* it is short. We do the prehashing here instead of in pbkdf2() so

View File

@ -8,7 +8,10 @@ final class KeyProtectedByPassword
{
const PASSWORD_KEY_CURRENT_VERSION = "\xDE\xF1\x00\x00";
private $encrypted_key = null;
/**
* @var string
*/
private $encrypted_key = '';
/**
* Creates a random key protected by the provided password.

View File

@ -17,6 +17,7 @@ class RuntimeTests extends Crypto
* Runs the runtime tests.
*
* @throws Ex\EnvironmentIsBrokenException
* @return void
*/
public static function runtimeTest()
{
@ -79,6 +80,7 @@ class RuntimeTests extends Crypto
* High-level tests of Crypto operations.
*
* @throws Ex\EnvironmentIsBrokenException
* @return void
*/
private static function testEncryptDecrypt()
{
@ -148,6 +150,7 @@ class RuntimeTests extends Crypto
* Test HKDF against test vectors.
*
* @throws Ex\EnvironmentIsBrokenException
* @return void
*/
private static function HKDFTestVector()
{
@ -186,6 +189,7 @@ class RuntimeTests extends Crypto
* Test HMAC against test vectors.
*
* @throws Ex\EnvironmentIsBrokenException
* @return void
*/
private static function HMACTestVector()
{
@ -202,6 +206,7 @@ class RuntimeTests extends Crypto
* Test AES against test vectors.
*
* @throws Ex\EnvironmentIsBrokenException
* @return void
*/
private static function AESTestVector()
{

View File

@ -337,6 +337,12 @@ abstract class AbstractWebApplication extends AbstractApplication
}
}
// Make sure there is a status header already otherwise generate it from the response
if (!$this->getResponse()->hasHeader('Status'))
{
$this->setHeader('Status', $this->getResponse()->getStatusCode());
}
$this->sendHeaders();
echo $this->getBody();
@ -687,7 +693,7 @@ abstract class AbstractWebApplication extends AbstractApplication
*
* @return string
*
* @since __DEPLOY_VERSION__
* @since 1.8.0
*/
protected function getHttpStatusValue($value)
{
@ -815,7 +821,7 @@ abstract class AbstractWebApplication extends AbstractApplication
*
* @return bool
*
* @since __DEPLOY_VERSION__
* @since 1.8.0
*/
protected function isRedirectState($state)
{

View File

@ -351,30 +351,19 @@ class DataSet implements DumpableInterface, \ArrayAccess, \Countable, \Iterator
* Note that this method will not return an associative array, otherwise it would be encoded into an object.
* JSON decoders do not consistently maintain the order of associative keys, whereas they do maintain the order of arrays.
*
* @param mixed $serialized An array of objects that have already been serialized that is used to infinite loops
* (null on first call).
*
* @return array An array that can be serialised by json_encode().
*
* @since 1.0
*/
public function jsonSerialize($serialized = null)
public function jsonSerialize()
{
// Check if we should initialise the recursion tracker.
if ($serialized === null)
{
$serialized = [];
}
// Add this object to the serialized stack.
$serialized[] = spl_object_hash($this);
$return = [];
$return = [];
// Iterate through the objects.
foreach ($this->objects as $object)
{
// Call the method for the object.
$return[] = json_encode($object);
$return[] = $object;
}
return $return;

View File

@ -235,7 +235,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
$class = __NAMESPACE__ . '\\' . ucfirst(strtolower($baseName)) . '\\' . ucfirst(strtolower($baseName)) . 'Driver';
// If the class doesn't exist, or if it's not supported on this system, move on to the next type.
if (!class_exists($class) || !($class::isSupported()))
if (!class_exists($class) || !$class::isSupported())
{
continue;
}
@ -270,11 +270,11 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
public static function getInstance(array $options = [])
{
// Sanitize the database connector options.
$options['driver'] = (isset($options['driver'])) ? preg_replace('/[^A-Z0-9_\.-]/i', '', $options['driver']) : 'mysqli';
$options['database'] = (isset($options['database'])) ? $options['database'] : null;
$options['select'] = (isset($options['select'])) ? $options['select'] : true;
$options['factory'] = (isset($options['factory'])) ? $options['factory'] : new DatabaseFactory;
$options['monitor'] = (isset($options['monitor'])) ? $options['monitor'] : null;
$options['driver'] = isset($options['driver']) ? preg_replace('/[^A-Z0-9_\.-]/i', '', $options['driver']) : 'mysqli';
$options['database'] = isset($options['database']) ? $options['database'] : null;
$options['select'] = isset($options['select']) ? $options['select'] : true;
$options['factory'] = isset($options['factory']) ? $options['factory'] : new DatabaseFactory;
$options['monitor'] = isset($options['monitor']) ? $options['monitor'] : null;
// Get the options signature for the database connector.
$signature = md5(serialize($options));
@ -316,25 +316,25 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
$lenEndString = strlen($endString);
$testEnd = substr($sql, $i, $lenEndString);
if ($current == '"' || $current == "'" || $current2 == '--'
|| ($current2 == '/*' && $current3 != '/*!' && $current3 != '/*+')
|| ($current == '#' && $current3 != '#__')
|| ($comment && $testEnd == $endString))
if ($current === '"' || $current === "'" || $current2 === '--'
|| ($current2 === '/*' && $current3 !== '/*!' && $current3 !== '/*+')
|| ($current === '#' && $current3 !== '#__')
|| ($comment && $testEnd === $endString))
{
// Check if quoted with previous backslash
$n = 2;
while (substr($sql, $i - $n + 1, 1) == '\\' && $n < $i)
while (substr($sql, $i - $n + 1, 1) === '\\' && $n < $i)
{
$n++;
}
// Not quoted
if ($n % 2 == 0)
if ($n % 2 === 0)
{
if ($open)
{
if ($testEnd == $endString)
if ($testEnd === $endString)
{
if ($comment)
{
@ -357,17 +357,17 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
{
$open = true;
if ($current2 == '--')
if ($current2 === '--')
{
$endString = "\n";
$comment = true;
}
elseif ($current2 == '/*')
elseif ($current2 === '/*')
{
$endString = '*/';
$comment = true;
}
elseif ($current == '#')
elseif ($current === '#')
{
$endString = "\n";
$comment = true;
@ -379,7 +379,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
if ($comment && $start < $i)
{
$query = $query . substr($sql, $start, ($i - $start));
$query .= substr($sql, $start, $i - $start);
}
}
}
@ -390,20 +390,20 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
$start = $i + 1;
}
if (($current == ';' && !$open) || $i == $end - 1)
if (($current === ';' && !$open) || $i === $end - 1)
{
if ($start <= $i)
{
$query = $query . substr($sql, $start, ($i - $start + 1));
$query .= substr($sql, $start, $i - $start + 1);
}
$query = trim($query);
if ($query)
{
if (($i == $end - 1) && ($current != ';'))
if (($i === $end - 1) && ($current !== ';'))
{
$query = $query . ';';
$query .= ';';
}
$queries[] = $query;
@ -455,8 +455,8 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
public function __construct(array $options)
{
// Initialise object variables.
$this->database = (isset($options['database'])) ? $options['database'] : '';
$this->tablePrefix = (isset($options['prefix'])) ? $options['prefix'] : '';
$this->database = isset($options['database']) ? $options['database'] : '';
$this->tablePrefix = isset($options['prefix']) ? $options['prefix'] : 'jos_';
$this->count = 0;
$this->errorNum = 0;
@ -897,7 +897,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
}
// Ignore any internal fields.
if ($k[0] == '_')
if ($k[0] === '_')
{
continue;
}
@ -1005,7 +1005,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
// Get all of the rows from the result set.
while ($row = $this->fetchAssoc($cursor))
{
$value = ($column) ? (isset($row[$column]) ? $row[$column] : $row) : $row;
$value = $column ? (isset($row[$column]) ? $row[$column] : $row) : $row;
if ($key)
{
@ -1332,7 +1332,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
if (!is_null($as))
{
settype($as, 'array');
$as = (array) $as;
$quotedAs .= ' AS ' . $this->quoteNameStr($as);
}
@ -1348,7 +1348,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
$fin[] = $this->quoteName($str);
}
}
elseif (is_array($name) && (count($name) == count($as)))
elseif (is_array($name) && (count($name) === count($as)))
{
$count = count($name);
@ -1382,7 +1382,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
continue;
}
if (strlen($q) == 1)
if (strlen($q) === 1)
{
$parts[] = $q . $part . $q;
}
@ -1465,7 +1465,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
$l = $k - 1;
while ($l >= 0 && $sql{$l} == '\\')
while ($l >= 0 && $sql{$l} === '\\')
{
$l--;
$escaped = !$escaped;
@ -1601,15 +1601,15 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
}
// Only process scalars that are not internal fields.
if (is_array($v) or is_object($v) or $k[0] == '_')
if (is_array($v) || is_object($v) || $k[0] === '_')
{
continue;
}
// Set the primary key to the WHERE clause instead of a field to update.
if (in_array($k, $key))
if (in_array($k, $key, true))
{
$where[] = $this->quoteName($k) . '=' . $this->quote($v);
$where[] = $this->quoteName($k) . ($v === null ? ' IS NULL' : ' = ' . $this->quote($v));
continue;
}
@ -1644,7 +1644,7 @@ abstract class DatabaseDriver implements DatabaseInterface, DispatcherAwareInter
}
// Set the query and execute the update.
$this->setQuery(sprintf($statement, implode(",", $fields), implode(' AND ', $where)))->execute();
$this->setQuery(sprintf($statement, implode(',', $fields), implode(' AND ', $where)))->execute();
return true;
}

View File

@ -33,8 +33,8 @@ class DatabaseFactory
{
// Sanitize the database connector options.
$options['driver'] = preg_replace('/[^A-Z0-9_\.-]/i', '', $name);
$options['database'] = (isset($options['database'])) ? $options['database'] : null;
$options['select'] = (isset($options['select'])) ? $options['select'] : true;
$options['database'] = isset($options['database']) ? $options['database'] : null;
$options['select'] = isset($options['select']) ? $options['select'] : true;
// Derive the class name from the driver.
$class = __NAMESPACE__ . '\\' . ucfirst(strtolower($options['driver'])) . '\\' . ucfirst(strtolower($options['driver'])) . 'Driver';

View File

@ -248,7 +248,7 @@ abstract class DatabaseImporter
// Convert the magic prefix into the real table name.
$tableName = $this->getRealTableName((string) $table['name']);
if (in_array($tableName, $tables))
if (in_array($tableName, $tables, true))
{
// The table already exists. Now check if there is any difference.
if ($queries = $this->getAlterTableql($xml->database->table_structure))

View File

@ -1761,7 +1761,7 @@ abstract class DatabaseQuery implements QueryInterface
$i = 1;
$func = function ($match) use ($query, $args, &$i)
{
if (isset($match[6]) && $match[6] == '%')
if (isset($match[6]) && $match[6] === '%')
{
return '%';
}

View File

@ -97,7 +97,7 @@ class MysqlDriver extends PdoDriver implements UTF8MB4SupportInterface
* and we cannot connect to it unless we know if it supports utf8mb4, which requires us knowing the server version. Because of this
* chicken and egg issue, we _assume_ it's supported and we'll just catch any problems at connection time.
*/
$this->utf8mb4 = $options['charset'] == 'utf8mb4';
$this->utf8mb4 = $options['charset'] === 'utf8mb4';
// Finalize initialisation.
parent::__construct($options);
@ -188,7 +188,7 @@ class MysqlDriver extends PdoDriver implements UTF8MB4SupportInterface
$beginningOfQuery = substr($query, 0, 12);
$beginningOfQuery = strtoupper($beginningOfQuery);
if (!in_array($beginningOfQuery, array('ALTER TABLE ', 'CREATE TABLE')))
if (!in_array($beginningOfQuery, array('ALTER TABLE ', 'CREATE TABLE'), true))
{
return $query;
}
@ -206,7 +206,7 @@ class MysqlDriver extends PdoDriver implements UTF8MB4SupportInterface
*/
public static function isSupported()
{
return class_exists('\\PDO') && in_array('mysql', \PDO::getAvailableDrivers());
return class_exists('\\PDO') && in_array('mysql', \PDO::getAvailableDrivers(), true);
}
/**
@ -337,7 +337,7 @@ class MysqlDriver extends PdoDriver implements UTF8MB4SupportInterface
$result = [];
// Sanitize input to an array and iterate over the list.
settype($tables, 'array');
$tables = (array) $tables;
foreach ($tables as $table)
{
@ -375,7 +375,7 @@ class MysqlDriver extends PdoDriver implements UTF8MB4SupportInterface
{
foreach ($fields as $field)
{
$result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
$result[$field->Field] = preg_replace('/[(0-9)]/', '', $field->Type);
}
}
// If we want the whole field data object add that to the list.

View File

@ -89,8 +89,8 @@ class MysqlImporter extends DatabaseImporter
$column = $oldFields[$fName];
// Test whether there is a change.
$change = ((string) $field['Type'] != $column->Type) || ((string) $field['Null'] != $column->Null)
|| ((string) $field['Default'] != $column->Default) || ((string) $field['Extra'] != $column->Extra);
$change = ((string) $field['Type'] !== $column->Type) || ((string) $field['Null'] !== $column->Null)
|| ((string) $field['Default'] !== $column->Default) || ((string) $field['Extra'] !== $column->Extra);
if ($change)
{
@ -129,16 +129,16 @@ class MysqlImporter extends DatabaseImporter
$oldCount = count($oldLookup[$name]);
// There is a key on this field in the old and new tables. Are they the same?
if ($newCount == $oldCount)
if ($newCount === $oldCount)
{
// Need to loop through each key and do a fine grained check.
for ($i = 0; $i < $newCount; $i++)
{
$same = (((string) $newLookup[$name][$i]['Non_unique'] == $oldLookup[$name][$i]->Non_unique)
&& ((string) $newLookup[$name][$i]['Column_name'] == $oldLookup[$name][$i]->Column_name)
&& ((string) $newLookup[$name][$i]['Seq_in_index'] == $oldLookup[$name][$i]->Seq_in_index)
&& ((string) $newLookup[$name][$i]['Collation'] == $oldLookup[$name][$i]->Collation)
&& ((string) $newLookup[$name][$i]['Index_type'] == $oldLookup[$name][$i]->Index_type));
$same = (((string) $newLookup[$name][$i]['Non_unique'] === $oldLookup[$name][$i]->Non_unique)
&& ((string) $newLookup[$name][$i]['Column_name'] === $oldLookup[$name][$i]->Column_name)
&& ((string) $newLookup[$name][$i]['Seq_in_index'] === $oldLookup[$name][$i]->Seq_in_index)
&& ((string) $newLookup[$name][$i]['Collation'] === $oldLookup[$name][$i]->Collation)
&& ((string) $newLookup[$name][$i]['Index_type'] === $oldLookup[$name][$i]->Index_type));
/*
Debug.
@ -194,7 +194,7 @@ class MysqlImporter extends DatabaseImporter
// Any keys left are orphans.
foreach ($oldLookup as $name => $keys)
{
if (strtoupper($name) == 'PRIMARY')
if (strtoupper($name) === 'PRIMARY')
{
$alters[] = $this->getDropPrimaryKeySql($table);
}
@ -246,9 +246,9 @@ class MysqlImporter extends DatabaseImporter
$sql = $this->db->quoteName($fName) . ' ' . $fType;
if ($fNull == 'NO')
if ($fNull === 'NO')
{
if (in_array($fType, $blobs) || $fDefault === null)
if ($fDefault === null || in_array($fType, $blobs, true))
{
$sql .= ' NOT NULL';
}
@ -364,7 +364,7 @@ class MysqlImporter extends DatabaseImporter
$prefix = '';
if ($kName == 'PRIMARY')
if ($kName === 'PRIMARY')
{
$prefix = 'PRIMARY ';
}
@ -376,7 +376,7 @@ class MysqlImporter extends DatabaseImporter
$nColumns = count($columns);
$kColumns = [];
if ($nColumns == 1)
if ($nColumns === 1)
{
$kColumns[] = $this->db->quoteName($kColumn);
}
@ -388,7 +388,7 @@ class MysqlImporter extends DatabaseImporter
}
}
return $prefix . 'KEY ' . ($kName != 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
return $prefix . 'KEY ' . ($kName !== 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
}
/**

View File

@ -284,7 +284,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
$beginningOfQuery = substr($query, 0, 12);
$beginningOfQuery = strtoupper($beginningOfQuery);
if (!in_array($beginningOfQuery, array('ALTER TABLE ', 'CREATE TABLE')))
if (!in_array($beginningOfQuery, array('ALTER TABLE ', 'CREATE TABLE'), true))
{
return $query;
}
@ -481,7 +481,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
*/
public function getNumRows($cursor = null)
{
return mysqli_num_rows($cursor ? $cursor : $this->cursor);
return mysqli_num_rows($cursor ?: $this->cursor);
}
/**
@ -501,7 +501,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
$result = [];
// Sanitize input to an array and iterate over the list.
settype($tables, 'array');
$tables = (array) $tables;
foreach ($tables as $table)
{
@ -540,7 +540,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
{
foreach ($fields as $field)
{
$result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
$result[$field->Field] = preg_replace('/[(0-9)]/', '', $field->Type);
}
}
else
@ -703,7 +703,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
$bindParams = array();
$bindParams[] = &$typeString;
for ($i = 0; $i < count($params); $i++)
for ($i = 0, $iMax = count($params); $i < $iMax; $i++)
{
$bindParams[] = &$params[$i];
}
@ -1042,7 +1042,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
*/
protected function fetchArray($cursor = null)
{
return mysqli_fetch_row($cursor ? $cursor : $this->cursor);
return mysqli_fetch_row($cursor ?: $this->cursor);
}
/**
@ -1056,7 +1056,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
*/
protected function fetchAssoc($cursor = null)
{
return mysqli_fetch_assoc($cursor ? $cursor : $this->cursor);
return mysqli_fetch_assoc($cursor ?: $this->cursor);
}
/**
@ -1071,7 +1071,7 @@ class MysqliDriver extends DatabaseDriver implements UTF8MB4SupportInterface
*/
protected function fetchObject($cursor = null, $class = '\\stdClass')
{
return mysqli_fetch_object($cursor ? $cursor : $this->cursor, $class);
return mysqli_fetch_object($cursor ?: $this->cursor, $class);
}
/**

View File

@ -57,7 +57,7 @@ class MysqliImporter extends DatabaseImporter
$existingTables = $this->db->getTableList();
$tableName = (string) $table['name'];
if (in_array($tableName, $existingTables))
if (in_array($tableName, $existingTables, true))
{
throw new \RuntimeException('The table you are trying to create already exists');
}
@ -127,8 +127,8 @@ class MysqliImporter extends DatabaseImporter
$column = $oldFields[$fName];
// Test whether there is a change.
$change = ((string) $field['Type'] != $column->Type) || ((string) $field['Null'] != $column->Null)
|| ((string) $field['Default'] != $column->Default) || ((string) $field['Extra'] != $column->Extra);
$change = ((string) $field['Type'] !== $column->Type) || ((string) $field['Null'] !== $column->Null)
|| ((string) $field['Default'] !== $column->Default) || ((string) $field['Extra'] !== $column->Extra);
if ($change)
{
@ -167,16 +167,16 @@ class MysqliImporter extends DatabaseImporter
$oldCount = count($oldLookup[$name]);
// There is a key on this field in the old and new tables. Are they the same?
if ($newCount == $oldCount)
if ($newCount === $oldCount)
{
// Need to loop through each key and do a fine grained check.
for ($i = 0; $i < $newCount; $i++)
{
$same = (((string) $newLookup[$name][$i]['Non_unique'] == $oldLookup[$name][$i]->Non_unique)
&& ((string) $newLookup[$name][$i]['Column_name'] == $oldLookup[$name][$i]->Column_name)
&& ((string) $newLookup[$name][$i]['Seq_in_index'] == $oldLookup[$name][$i]->Seq_in_index)
&& ((string) $newLookup[$name][$i]['Collation'] == $oldLookup[$name][$i]->Collation)
&& ((string) $newLookup[$name][$i]['Index_type'] == $oldLookup[$name][$i]->Index_type));
$same = (((string) $newLookup[$name][$i]['Non_unique'] === $oldLookup[$name][$i]->Non_unique)
&& ((string) $newLookup[$name][$i]['Column_name'] === $oldLookup[$name][$i]->Column_name)
&& ((string) $newLookup[$name][$i]['Seq_in_index'] === $oldLookup[$name][$i]->Seq_in_index)
&& ((string) $newLookup[$name][$i]['Collation'] === $oldLookup[$name][$i]->Collation)
&& ((string) $newLookup[$name][$i]['Index_type'] === $oldLookup[$name][$i]->Index_type));
/*
Debug.
@ -232,7 +232,7 @@ class MysqliImporter extends DatabaseImporter
// Any keys left are orphans.
foreach ($oldLookup as $name => $keys)
{
if (strtoupper($name) == 'PRIMARY')
if (strtoupper($name) === 'PRIMARY')
{
$alters[] = $this->getDropPrimaryKeySql($table);
}
@ -283,9 +283,9 @@ class MysqliImporter extends DatabaseImporter
$sql = $this->db->quoteName($fName) . ' ' . $fType;
if ($fNull == 'NO')
if ($fNull === 'NO')
{
if (in_array($fType, $blobs) || $fDefault === null)
if ($fDefault === null || in_array($fType, $blobs, true))
{
$sql .= ' NOT NULL';
}
@ -400,7 +400,7 @@ class MysqliImporter extends DatabaseImporter
$prefix = '';
if ($kName == 'PRIMARY')
if ($kName === 'PRIMARY')
{
$prefix = 'PRIMARY ';
}
@ -412,7 +412,7 @@ class MysqliImporter extends DatabaseImporter
$nColumns = count($columns);
$kColumns = [];
if ($nColumns == 1)
if ($nColumns === 1)
{
$kColumns[] = $this->db->quoteName($kColumn);
}
@ -424,6 +424,6 @@ class MysqliImporter extends DatabaseImporter
}
}
return $prefix . 'KEY ' . ($kName != 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
return $prefix . 'KEY ' . ($kName !== 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
}
}

View File

@ -65,8 +65,8 @@ class OracleDriver extends PdoDriver
public function __construct(array $options)
{
$options['driver'] = 'oci';
$options['charset'] = (isset($options['charset'])) ? $options['charset'] : 'AL32UTF8';
$options['dateformat'] = (isset($options['dateformat'])) ? $options['dateformat'] : 'RRRR-MM-DD HH24:MI:SS';
$options['charset'] = isset($options['charset']) ? $options['charset'] : 'AL32UTF8';
$options['dateformat'] = isset($options['dateformat']) ? $options['dateformat'] : 'RRRR-MM-DD HH24:MI:SS';
$this->charset = $options['charset'];
$this->dateformat = $options['dateformat'];
@ -234,7 +234,7 @@ class OracleDriver extends PdoDriver
$query->bind(':type', 'TABLE');
// Sanitize input to an array and iterate over the list.
settype($tables, 'array');
$tables = (array) $tables;
foreach ($tables as $table)
{
@ -515,7 +515,7 @@ class OracleDriver extends PdoDriver
*/
public static function isSupported()
{
return class_exists('\\PDO') && in_array('oci', \PDO::getAvailableDrivers());
return class_exists('\\PDO') && in_array('oci', \PDO::getAvailableDrivers(), true);
}
/**
@ -578,7 +578,7 @@ class OracleDriver extends PdoDriver
$l = $k - 1;
while ($l >= 0 && $sql{$l} == '\\')
while ($l >= 0 && $sql{$l} === '\\')
{
$l--;
$escaped = !$escaped;

View File

@ -155,13 +155,13 @@ class OracleQuery extends PdoQuery implements PreparableInterface, LimitableInte
// Check if we need to mangle the query.
if ($limit || $offset)
{
$query = "SELECT joomla2.*
$query = 'SELECT joomla2.*
FROM (
SELECT joomla1.*, ROWNUM AS joomla_db_rownum
FROM (
" . $query . "
' . $query . '
) joomla1
) joomla2";
) joomla2';
// Check if the limit value is greater than zero.
if ($limit > 0)

View File

@ -86,14 +86,14 @@ abstract class PdoDriver extends DatabaseDriver
public function __construct(array $options)
{
// Get some basic values from the options.
$options['driver'] = (isset($options['driver'])) ? $options['driver'] : 'odbc';
$options['dsn'] = (isset($options['dsn'])) ? $options['dsn'] : '';
$options['host'] = (isset($options['host'])) ? $options['host'] : 'localhost';
$options['database'] = (isset($options['database'])) ? $options['database'] : '';
$options['user'] = (isset($options['user'])) ? $options['user'] : '';
$options['port'] = (isset($options['port'])) ? (int) $options['port'] : null;
$options['password'] = (isset($options['password'])) ? $options['password'] : '';
$options['driverOptions'] = (isset($options['driverOptions'])) ? $options['driverOptions'] : [];
$options['driver'] = isset($options['driver']) ? $options['driver'] : 'odbc';
$options['dsn'] = isset($options['dsn']) ? $options['dsn'] : '';
$options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
$options['database'] = isset($options['database']) ? $options['database'] : '';
$options['user'] = isset($options['user']) ? $options['user'] : '';
$options['port'] = isset($options['port']) ? (int) $options['port'] : null;
$options['password'] = isset($options['password']) ? $options['password'] : '';
$options['driverOptions'] = isset($options['driverOptions']) ? $options['driverOptions'] : [];
// Finalize initialisation
parent::__construct($options);
@ -134,7 +134,7 @@ abstract class PdoDriver extends DatabaseDriver
switch ($this->options['driver'])
{
case 'cubrid':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 33000;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 33000;
$format = 'cubrid:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
@ -144,7 +144,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'dblib':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1433;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 1433;
$format = 'dblib:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
@ -154,7 +154,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'firebird':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 3050;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 3050;
$format = 'firebird:dbname=#DBNAME#';
@ -164,7 +164,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'ibm':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 56789;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 56789;
if (!empty($this->options['dsn']))
{
@ -184,8 +184,8 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'informix':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1526;
$this->options['protocol'] = (isset($this->options['protocol'])) ? $this->options['protocol'] : 'onsoctcp';
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 1526;
$this->options['protocol'] = isset($this->options['protocol']) ? $this->options['protocol'] : 'onsoctcp';
if (!empty($this->options['dsn']))
{
@ -211,7 +211,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'mssql':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1433;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 1433;
$format = 'mssql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
@ -221,7 +221,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'mysql':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 3306;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 3306;
$format = 'mysql:host=#HOST#;port=#PORT#;dbname=#DBNAME#;charset=#CHARSET#';
@ -231,8 +231,8 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'oci':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1521;
$this->options['charset'] = (isset($this->options['charset'])) ? $this->options['charset'] : 'AL32UTF8';
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 1521;
$this->options['charset'] = isset($this->options['charset']) ? $this->options['charset'] : 'AL32UTF8';
if (!empty($this->options['dsn']))
{
@ -262,7 +262,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'pgsql':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 5432;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 5432;
$format = 'pgsql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
@ -287,7 +287,7 @@ abstract class PdoDriver extends DatabaseDriver
break;
case 'sybase':
$this->options['port'] = (isset($this->options['port'])) ? $this->options['port'] : 1433;
$this->options['port'] = isset($this->options['port']) ? $this->options['port'] : 1433;
$format = 'mssql:host=#HOST#;port=#PORT#;dbname=#DBNAME#';
@ -427,7 +427,7 @@ abstract class PdoDriver extends DatabaseDriver
{
// Get the error number and message before we execute any more queries.
$errorNum = (int) $this->connection->errorCode();
$errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());
$errorMsg = (string) 'SQL: ' . implode(', ', $this->connection->errorInfo());
// Check if the server was disconnected.
if (!$this->connected())
@ -443,7 +443,7 @@ abstract class PdoDriver extends DatabaseDriver
{
// Get the error number and message.
$this->errorNum = (int) $this->connection->errorCode();
$this->errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());
$this->errorMsg = (string) 'SQL: ' . implode(', ', $this->connection->errorInfo());
throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
}
@ -578,7 +578,7 @@ abstract class PdoDriver extends DatabaseDriver
$status = (bool) $this->loadResult();
}
catch (\Exception $e)
// If we catch an exception here, we must not be connected.
// If we catch an exception here, we must not be connected.
{
$status = false;
}
@ -733,7 +733,7 @@ abstract class PdoDriver extends DatabaseDriver
{
$this->connect();
if (!$toSavepoint || $this->transactionDepth == 1)
if (!$toSavepoint || $this->transactionDepth === 1)
{
$this->connection->commit();
}
@ -755,7 +755,7 @@ abstract class PdoDriver extends DatabaseDriver
{
$this->connect();
if (!$toSavepoint || $this->transactionDepth == 1)
if (!$toSavepoint || $this->transactionDepth === 1)
{
$this->connection->rollBack();
}
@ -893,7 +893,7 @@ abstract class PdoDriver extends DatabaseDriver
// Execute the query and get the result set cursor.
if (!$this->executed)
{
if (!($this->execute()))
if (!$this->execute())
{
return $this->errorNum ? null : false;
}
@ -932,9 +932,9 @@ abstract class PdoDriver extends DatabaseDriver
foreach ($properties as $property)
{
// Do not serialize properties that are PDO
if ($property->isStatic() == false && !($this->{$property->name} instanceof \PDO))
if ($property->isStatic() === false && !($this->{$property->name} instanceof \PDO))
{
array_push($serializedProperties, $property->name);
$serializedProperties[] = $property->name;
}
}

View File

@ -71,11 +71,11 @@ class PgsqlDriver extends PdoDriver
public function __construct($options)
{
$options['driver'] = 'pgsql';
$options['host'] = (isset($options['host'])) ? $options['host'] : 'localhost';
$options['user'] = (isset($options['user'])) ? $options['user'] : '';
$options['password'] = (isset($options['password'])) ? $options['password'] : '';
$options['database'] = (isset($options['database'])) ? $options['database'] : '';
$options['port'] = (isset($options['port'])) ? $options['port'] : null;
$options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
$options['user'] = isset($options['user']) ? $options['user'] : '';
$options['password'] = isset($options['password']) ? $options['password'] : '';
$options['database'] = isset($options['database']) ? $options['database'] : '';
$options['port'] = isset($options['port']) ? $options['port'] : null;
// Finalize initialization
parent::__construct($options);
@ -219,21 +219,21 @@ class PgsqlDriver extends PdoDriver
{
foreach ($fields as $field)
{
$result[$field->column_name] = preg_replace("/[(0-9)]/", '', $field->type);
$result[$field->column_name] = preg_replace('/[(0-9)]/', '', $field->type);
}
}
else
{
foreach ($fields as $field)
{
if (stristr(strtolower($field->type), "character varying"))
if (stristr(strtolower($field->type), 'character varying'))
{
$field->Default = "";
$field->Default = '';
}
if (stristr(strtolower($field->type), "text"))
if (stristr(strtolower($field->type), 'text'))
{
$field->Default = "";
$field->Default = '';
}
// Do some dirty translation to MySQL output.
@ -256,7 +256,7 @@ class PgsqlDriver extends PdoDriver
// Change Postgresql's NULL::* type with PHP's null one
foreach ($fields as $field)
{
if (preg_match("/^NULL::*/", $field->Default))
if (preg_match('/^NULL::*/', $field->Default))
{
$field->Default = null;
}
@ -282,7 +282,7 @@ class PgsqlDriver extends PdoDriver
// To check if table exists and prevent SQL injection
$tableList = $this->getTableList();
if (in_array($table, $tableList))
if (in_array($table, $tableList, true))
{
// Get the details columns information.
$this->setQuery('
@ -341,7 +341,7 @@ class PgsqlDriver extends PdoDriver
// To check if table exists and prevent SQL injection
$tableList = $this->getTableList();
if (in_array($table, $tableList))
if (in_array($table, $tableList, true))
{
$name = [
's.relname', 'n.nspname', 't.relname', 'a.attname', 'info.data_type',
@ -407,7 +407,7 @@ class PgsqlDriver extends PdoDriver
$tableList = $this->getTableList();
// Origin Table does not exist
if (!in_array($oldTable, $tableList))
if (!in_array($oldTable, $tableList, true))
{
// Origin Table not found
throw new \RuntimeException('Table not found in Postgresql database.');
@ -483,14 +483,15 @@ class PgsqlDriver extends PdoDriver
case 'boolean':
$val = 'NULL';
if ($field_value == 't')
if ($field_value === 't' || $field_value === true || $field_value === 1 || $field_value === '1')
{
$val = 'TRUE';
}
elseif ($field_value == 'f')
elseif ($field_value === 'f' || $field_value === false || $field_value === 0 || $field_value === '0')
{
$val = 'FALSE';
}
break;
case 'bigint':
@ -502,7 +503,7 @@ class PgsqlDriver extends PdoDriver
case 'smallint':
case 'serial':
case 'numeric,':
$val = strlen($field_value) == 0 ? 'NULL' : $field_value;
$val = $field_value === '' ? 'NULL' : $field_value;
break;
case 'date':
@ -632,19 +633,19 @@ class PgsqlDriver extends PdoDriver
foreach (get_object_vars($object) as $k => $v)
{
// Skip columns that don't exist in the table.
if (! array_key_exists($k, $columns))
if (!array_key_exists($k, $columns))
{
continue;
}
// Only process non-null scalars.
if (is_array($v) or is_object($v) or $v === null)
if (is_array($v) || is_object($v) || $v === null)
{
continue;
}
// Ignore any internal fields or primary keys with value 0.
if (($k[0] == "_") || ($k == $key && (($v === 0) || ($v === '0'))))
if (($k[0] === '_') || ($k == $key && (($v === 0) || ($v === '0'))))
{
continue;
}
@ -701,7 +702,7 @@ class PgsqlDriver extends PdoDriver
*/
public static function isSupported()
{
return class_exists('\\PDO') && in_array('pgsql', \PDO::getAvailableDrivers());
return class_exists('\\PDO') && in_array('pgsql', \PDO::getAvailableDrivers(), true);
}
/**
@ -814,7 +815,7 @@ class PgsqlDriver extends PdoDriver
{
$sql = explode('currval', $sql);
for ($nIndex = 1; $nIndex < count($sql); $nIndex = $nIndex + 2)
for ($nIndex = 1, $nIndexMax = count($sql); $nIndex < $nIndexMax; $nIndex += 2)
{
$sql[$nIndex] = str_replace($prefix, $this->tablePrefix, $sql[$nIndex]);
}
@ -827,7 +828,7 @@ class PgsqlDriver extends PdoDriver
{
$sql = explode('nextval', $sql);
for ($nIndex = 1; $nIndex < count($sql); $nIndex = $nIndex + 2)
for ($nIndex = 1, $nIndexMax = count($sql); $nIndex < $nIndexMax; $nIndex += 2)
{
$sql[$nIndex] = str_replace($prefix, $this->tablePrefix, $sql[$nIndex]);
}
@ -840,7 +841,7 @@ class PgsqlDriver extends PdoDriver
{
$sql = explode('setval', $sql);
for ($nIndex = 1; $nIndex < count($sql); $nIndex = $nIndex + 2)
for ($nIndex = 1, $nIndexMax = count($sql); $nIndex < $nIndexMax; $nIndex += 2)
{
$sql[$nIndex] = str_replace($prefix, $this->tablePrefix, $sql[$nIndex]);
}
@ -850,7 +851,7 @@ class PgsqlDriver extends PdoDriver
$explodedQuery = explode('\'', $sql);
for ($nIndex = 0; $nIndex < count($explodedQuery); $nIndex = $nIndex + 2)
for ($nIndex = 0, $nIndexMax = count($explodedQuery); $nIndex < $nIndexMax; $nIndex += 2)
{
if (strpos($explodedQuery[$nIndex], $prefix))
{
@ -925,13 +926,13 @@ class PgsqlDriver extends PdoDriver
}
// Only process scalars that are not internal fields.
if (is_array($v) or is_object($v) or $k[0] == '_')
if (is_array($v) || is_object($v) || $k[0] === '_')
{
continue;
}
// Set the primary key to the WHERE clause instead of a field to update.
if (in_array($k, $key))
if (in_array($k, $key, true))
{
$key_val = $this->sqlValue($columns, $k, $v);
$where[] = $this->quoteName($k) . '=' . $key_val;
@ -967,7 +968,7 @@ class PgsqlDriver extends PdoDriver
}
// Set the query and execute the update.
$this->setQuery(sprintf($statement, implode(",", $fields), implode(' AND ', $where)));
$this->setQuery(sprintf($statement, implode(',', $fields), implode(' AND ', $where)));
return $this->execute();
}

View File

@ -101,11 +101,11 @@ class PostgresqlDriver extends DatabaseDriver
*/
public function __construct(array $options)
{
$options['host'] = (isset($options['host'])) ? $options['host'] : 'localhost';
$options['user'] = (isset($options['user'])) ? $options['user'] : '';
$options['password'] = (isset($options['password'])) ? $options['password'] : '';
$options['database'] = (isset($options['database'])) ? $options['database'] : '';
$options['port'] = (isset($options['port'])) ? $options['port'] : null;
$options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
$options['user'] = isset($options['user']) ? $options['user'] : '';
$options['password'] = isset($options['password']) ? $options['password'] : '';
$options['database'] = isset($options['database']) ? $options['database'] : '';
$options['port'] = isset($options['port']) ? $options['port'] : null;
// Finalize initialization
parent::__construct($options);
@ -148,7 +148,7 @@ class PostgresqlDriver extends DatabaseDriver
*/
// Check for empty port
if (!($this->options['port']))
if (!$this->options['port'])
{
// Port is empty or not set via options, check for port annotation (:) in the host string
$tmp = substr(strstr($this->options['host'], ':'), 1);
@ -165,7 +165,7 @@ class PostgresqlDriver extends DatabaseDriver
$this->options['host'] = substr($this->options['host'], 0, strlen($this->options['host']) - (strlen($tmp) + 1));
// This will take care of the following notation: ":5432"
if ($this->options['host'] == '')
if ($this->options['host'] === '')
{
$this->options['host'] = 'localhost';
}
@ -408,21 +408,21 @@ class PostgresqlDriver extends DatabaseDriver
{
foreach ($fields as $field)
{
$result[$field->column_name] = preg_replace("/[(0-9)]/", '', $field->type);
$result[$field->column_name] = preg_replace('/[(0-9)]/', '', $field->type);
}
}
else
{
foreach ($fields as $field)
{
if (stristr(strtolower($field->type), "character varying"))
if (stristr(strtolower($field->type), 'character varying'))
{
$field->Default = "";
$field->Default = '';
}
if (stristr(strtolower($field->type), "text"))
if (stristr(strtolower($field->type), 'text'))
{
$field->Default = "";
$field->Default = '';
}
// Do some dirty translation to MySQL output.
@ -445,7 +445,7 @@ class PostgresqlDriver extends DatabaseDriver
// Change Postgresql's NULL::* type with PHP's null one
foreach ($fields as $field)
{
if (preg_match("/^NULL::*/", $field->Default))
if (preg_match('/^NULL::*/', $field->Default))
{
$field->Default = null;
}
@ -471,7 +471,7 @@ class PostgresqlDriver extends DatabaseDriver
// To check if table exists and prevent SQL injection
$tableList = $this->getTableList();
if (!in_array($table, $tableList))
if (!in_array($table, $tableList, true))
{
return false;
}
@ -532,7 +532,7 @@ class PostgresqlDriver extends DatabaseDriver
// To check if table exists and prevent SQL injection
$tableList = $this->getTableList();
if (!in_array($table, $tableList))
if (!in_array($table, $tableList, true))
{
return false;
}
@ -773,7 +773,7 @@ class PostgresqlDriver extends DatabaseDriver
$tableList = $this->getTableList();
// Origin Table does not exist
if (!in_array($oldTable, $tableList))
if (!in_array($oldTable, $tableList, true))
{
// Origin Table not found
throw new \RuntimeException('Table not found in PostgreSQL database.');
@ -918,11 +918,11 @@ class PostgresqlDriver extends DatabaseDriver
case 'boolean':
$val = 'NULL';
if ($field_value == 't')
if ($field_value === 't' || $field_value === true || $field_value === 1 || $field_value === '1')
{
$val = 'TRUE';
}
elseif ($field_value == 'f')
elseif ($field_value === 'f' || $field_value === false || $field_value === 0 || $field_value === '0')
{
$val = 'FALSE';
}
@ -937,7 +937,7 @@ class PostgresqlDriver extends DatabaseDriver
case 'smallint':
case 'serial':
case 'numeric,':
$val = strlen($field_value) == 0 ? 'NULL' : $field_value;
$val = $field_value === '' ? 'NULL' : $field_value;
break;
case 'date':
@ -1056,7 +1056,7 @@ class PostgresqlDriver extends DatabaseDriver
*/
protected function fetchArray($cursor = null)
{
return pg_fetch_row($cursor ? $cursor : $this->cursor);
return pg_fetch_row($cursor ?: $this->cursor);
}
/**
@ -1070,7 +1070,7 @@ class PostgresqlDriver extends DatabaseDriver
*/
protected function fetchAssoc($cursor = null)
{
return pg_fetch_assoc($cursor ? $cursor : $this->cursor);
return pg_fetch_assoc($cursor ?: $this->cursor);
}
/**
@ -1142,7 +1142,7 @@ class PostgresqlDriver extends DatabaseDriver
}
// Ignore any internal fields or primary keys with value 0.
if (($k[0] == "_") || ($k == $key && (($v === 0) || ($v === '0'))))
if (($k[0] === '_') || ($k == $key && (($v === 0) || ($v === '0'))))
{
continue;
}
@ -1311,7 +1311,7 @@ class PostgresqlDriver extends DatabaseDriver
{
$sql = explode('currval', $sql);
for ($nIndex = 1; $nIndex < count($sql); $nIndex = $nIndex + 2)
for ($nIndex = 1, $nIndexMax = count($sql); $nIndex < $nIndexMax; $nIndex += 2)
{
$sql[$nIndex] = str_replace($prefix, $this->tablePrefix, $sql[$nIndex]);
}
@ -1324,7 +1324,7 @@ class PostgresqlDriver extends DatabaseDriver
{
$sql = explode('nextval', $sql);
for ($nIndex = 1; $nIndex < count($sql); $nIndex = $nIndex + 2)
for ($nIndex = 1, $nIndexMax = count($sql); $nIndex < $nIndexMax; $nIndex += 2)
{
$sql[$nIndex] = str_replace($prefix, $this->tablePrefix, $sql[$nIndex]);
}
@ -1337,7 +1337,7 @@ class PostgresqlDriver extends DatabaseDriver
{
$sql = explode('setval', $sql);
for ($nIndex = 1; $nIndex < count($sql); $nIndex = $nIndex + 2)
for ($nIndex = 1, $nIndexMax = count($sql); $nIndex < $nIndexMax; $nIndex += 2)
{
$sql[$nIndex] = str_replace($prefix, $this->tablePrefix, $sql[$nIndex]);
}
@ -1347,7 +1347,7 @@ class PostgresqlDriver extends DatabaseDriver
$explodedQuery = explode('\'', $sql);
for ($nIndex = 0; $nIndex < count($explodedQuery); $nIndex = $nIndex + 2)
for ($nIndex = 0, $nIndexMax = count($explodedQuery); $nIndex < $nIndexMax; $nIndex += 2)
{
if (strpos($explodedQuery[$nIndex], $prefix))
{
@ -1456,13 +1456,13 @@ class PostgresqlDriver extends DatabaseDriver
}
// Only process scalars that are not internal fields.
if (is_array($v) || is_object($v) || $k[0] == '_')
if (is_array($v) || is_object($v) || $k[0] === '_')
{
continue;
}
// Set the primary key to the WHERE clause instead of a field to update.
if (in_array($k, $key))
if (in_array($k, $key, true))
{
$key_val = $this->sqlValue($columns, $k, $v);
$where[] = $this->quoteName($k) . '=' . $key_val;
@ -1500,6 +1500,6 @@ class PostgresqlDriver extends DatabaseDriver
}
// Set the query and execute the update.
return $this->setQuery(sprintf($statement, implode(",", $fields), implode(' AND ', $where)))->execute();
return $this->setQuery(sprintf($statement, implode(',', $fields), implode(' AND ', $where)))->execute();
}
}

View File

@ -90,16 +90,16 @@ class PostgresqlImporter extends DatabaseImporter
$column = $oldSeq[$kSeqName][0];
// Test whether there is a change.
$change = ((string) $vSeq[0]['Type'] != $column->Type)
|| ((string) $vSeq[0]['Start_Value'] != $column->Start_Value)
|| ((string) $vSeq[0]['Min_Value'] != $column->Min_Value)
|| ((string) $vSeq[0]['Max_Value'] != $column->Max_Value)
|| ((string) $vSeq[0]['Increment'] != $column->Increment)
|| ((string) $vSeq[0]['Cycle_option'] != $column->Cycle_option)
|| ((string) $vSeq[0]['Table'] != $column->Table)
|| ((string) $vSeq[0]['Column'] != $column->Column)
|| ((string) $vSeq[0]['Schema'] != $column->Schema)
|| ((string) $vSeq[0]['Name'] != $column->Name);
$change = ((string) $vSeq[0]['Type'] !== $column->Type)
|| ((string) $vSeq[0]['Start_Value'] !== $column->Start_Value)
|| ((string) $vSeq[0]['Min_Value'] !== $column->Min_Value)
|| ((string) $vSeq[0]['Max_Value'] !== $column->Max_Value)
|| ((string) $vSeq[0]['Increment'] !== $column->Increment)
|| ((string) $vSeq[0]['Cycle_option'] !== $column->Cycle_option)
|| ((string) $vSeq[0]['Table'] !== $column->Table)
|| ((string) $vSeq[0]['Column'] !== $column->Column)
|| ((string) $vSeq[0]['Schema'] !== $column->Schema)
|| ((string) $vSeq[0]['Name'] !== $column->Name);
if ($change)
{
@ -135,8 +135,8 @@ class PostgresqlImporter extends DatabaseImporter
$column = $oldFields[$fName];
// Test whether there is a change.
$change = ((string) $field['Type'] != $column->Type) || ((string) $field['Null'] != $column->Null)
|| ((string) $field['Default'] != $column->Default);
$change = ((string) $field['Type'] !== $column->Type) || ((string) $field['Null'] !== $column->Null)
|| ((string) $field['Default'] !== $column->Default);
if ($change)
{
@ -176,12 +176,12 @@ class PostgresqlImporter extends DatabaseImporter
$oldCount = count($oldLookup[$name]);
// There is a key on this field in the old and new tables. Are they the same?
if ($newCount == $oldCount)
if ($newCount === $oldCount)
{
for ($i = 0; $i < $newCount; $i++)
{
// Check only query field -> different query means different index
$same = ((string) $newLookup[$name][$i]['Query'] == $oldLookup[$name][$i]->Query);
$same = ((string) $newLookup[$name][$i]['Query'] === $oldLookup[$name][$i]->Query);
if (!$same)
{
@ -215,7 +215,7 @@ class PostgresqlImporter extends DatabaseImporter
// Any keys left are orphans.
foreach ($oldLookup as $name => $keys)
{
if ($oldLookup[$name][0]->is_primary == 'TRUE')
if ($oldLookup[$name][0]->is_primary === 'TRUE')
{
$alters[] = $this->getDropPrimaryKeySql($table, $oldLookup[$name][0]->Index);
}
@ -256,7 +256,7 @@ class PostgresqlImporter extends DatabaseImporter
$sql = 'CREATE SEQUENCE ' . (string) $field['Name']
. ' INCREMENT BY ' . (string) $field['Increment'] . ' MINVALUE ' . $field['Min_Value']
. ' MAXVALUE ' . (string) $field['Max_Value'] . ' START ' . (string) $field['Start_Value']
. (((string) $field['Cycle_option'] == 'NO') ? ' NO' : '') . ' CYCLE'
. (((string) $field['Cycle_option'] === 'NO') ? ' NO' : '') . ' CYCLE'
. ' OWNED BY ' . $this->db->quoteName((string) $field['Schema'] . '.' . (string) $field['Table'] . '.' . (string) $field['Column']);
return $sql;
@ -322,9 +322,9 @@ class PostgresqlImporter extends DatabaseImporter
$sql = ' TYPE ' . $fType;
if ($fNull == 'NO')
if ($fNull === 'NO')
{
if (in_array($fType, $blobs) || $fDefault === null)
if ($fDefault === null || in_array($fType, $blobs, true))
{
$sql .= ",\nALTER COLUMN " . $this->db->quoteName($fName) . ' SET NOT NULL'
. ",\nALTER COLUMN " . $this->db->quoteName($fName) . ' DROP DEFAULT';
@ -386,9 +386,9 @@ class PostgresqlImporter extends DatabaseImporter
{
$sql = $this->db->quoteName($fName) . ' ' . $fType;
if ($fNull == 'NO')
if ($fNull === 'NO')
{
if (in_array($fType, $blobs) || $fDefault === null)
if ($fDefault === null || in_array($fType, $blobs, true))
{
$sql .= ' NOT NULL';
}

View File

@ -723,13 +723,13 @@ class PostgresqlQuery extends DatabaseQuery implements LimitableInterface, Prepa
*/
public function dateAdd($date, $interval, $datePart)
{
if (substr($interval, 0, 1) != '-')
if (substr($interval, 0, 1) !== '-')
{
return "timestamp '" . $date . "' + interval '" . $interval . " " . $datePart . "'";
return "timestamp '" . $date . "' + interval '" . $interval . ' ' . $datePart . "'";
}
else
{
return "timestamp '" . $date . "' - interval '" . ltrim($interval, '-') . " " . $datePart . "'";
return "timestamp '" . $date . "' - interval '" . ltrim($interval, '-') . ' ' . $datePart . "'";
}
}

View File

@ -69,7 +69,7 @@ class QueryElement
*/
public function __toString()
{
if (substr($this->name, -2) == '()')
if (substr($this->name, -2) === '()')
{
return PHP_EOL . substr($this->name, 0, -2) . '(' . implode($this->glue, $this->elements) . ')';
}

View File

@ -199,7 +199,7 @@ class SqliteDriver extends PdoDriver
$this->connect();
// Sanitize input to an array and iterate over the list.
settype($tables, 'array');
$tables = (array) $tables;
return $tables;
}
@ -245,9 +245,9 @@ class SqliteDriver extends PdoDriver
$columns[$field->NAME] = (object) [
'Field' => $field->NAME,
'Type' => $field->TYPE,
'Null' => ($field->NOTNULL == '1' ? 'NO' : 'YES'),
'Null' => $field->NOTNULL == '1' ? 'NO' : 'YES',
'Default' => $field->DFLT_VALUE,
'Key' => ($field->PK != '0' ? 'PRI' : ''),
'Key' => $field->PK != '0' ? 'PRI' : '',
];
}
}
@ -441,7 +441,7 @@ class SqliteDriver extends PdoDriver
*/
public static function isSupported()
{
return class_exists('\\PDO') && class_exists('\\SQLite3') && in_array('sqlite', \PDO::getAvailableDrivers());
return class_exists('\\PDO') && class_exists('\\SQLite3') && in_array('sqlite', \PDO::getAvailableDrivers(), true);
}
/**

View File

@ -83,11 +83,11 @@ class SqlsrvDriver extends DatabaseDriver
public function __construct(array $options)
{
// Get some basic values from the options.
$options['host'] = (isset($options['host'])) ? $options['host'] : 'localhost';
$options['user'] = (isset($options['user'])) ? $options['user'] : '';
$options['password'] = (isset($options['password'])) ? $options['password'] : '';
$options['database'] = (isset($options['database'])) ? $options['database'] : '';
$options['select'] = (isset($options['select'])) ? (bool) $options['select'] : true;
$options['host'] = isset($options['host']) ? $options['host'] : 'localhost';
$options['user'] = isset($options['user']) ? $options['user'] : '';
$options['password'] = isset($options['password']) ? $options['password'] : '';
$options['database'] = isset($options['database']) ? $options['database'] : '';
$options['select'] = isset($options['select']) ? (bool) $options['select'] : true;
// Finalize initialisation
parent::__construct($options);
@ -364,7 +364,7 @@ class SqlsrvDriver extends DatabaseDriver
{
$this->connect();
return sqlsrv_num_rows($cursor ? $cursor : $this->cursor);
return sqlsrv_num_rows($cursor ?: $this->cursor);
}
/**
@ -396,7 +396,7 @@ class SqlsrvDriver extends DatabaseDriver
{
foreach ($fields as $field)
{
$result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
$result[$field->Field] = preg_replace('/[(0-9)]/', '', $field->Type);
}
}
else
@ -519,13 +519,13 @@ class SqlsrvDriver extends DatabaseDriver
continue;
}
if ($k[0] == '_')
if ($k[0] === '_')
{
// Internal field
continue;
}
if ($k == $key && $key == 0)
if ($k === $key && $key == 0)
{
continue;
}
@ -601,7 +601,7 @@ class SqlsrvDriver extends DatabaseDriver
$options = [];
// SQLSrv_num_rows requires a static or keyset cursor.
if (strncmp(ltrim(strtoupper($sql)), 'SELECT', strlen('SELECT')) == 0)
if (strncmp(strtoupper(ltrim($sql)), 'SELECT', strlen('SELECT')) === 0)
{
$options = ['Scrollable' => SQLSRV_CURSOR_KEYSET];
}
@ -742,7 +742,7 @@ class SqlsrvDriver extends DatabaseDriver
$l = $k - 1;
while ($l >= 0 && $sql{$l} == '\\')
while ($l >= 0 && $sql{$l} === '\\')
{
$l--;
$escaped = !$escaped;
@ -941,7 +941,7 @@ class SqlsrvDriver extends DatabaseDriver
*/
protected function fetchArray($cursor = null)
{
return sqlsrv_fetch_array($cursor ? $cursor : $this->cursor, SQLSRV_FETCH_NUMERIC);
return sqlsrv_fetch_array($cursor ?: $this->cursor, SQLSRV_FETCH_NUMERIC);
}
/**
@ -955,7 +955,7 @@ class SqlsrvDriver extends DatabaseDriver
*/
protected function fetchAssoc($cursor = null)
{
return sqlsrv_fetch_array($cursor ? $cursor : $this->cursor, SQLSRV_FETCH_ASSOC);
return sqlsrv_fetch_array($cursor ?: $this->cursor, SQLSRV_FETCH_ASSOC);
}
/**
@ -970,7 +970,7 @@ class SqlsrvDriver extends DatabaseDriver
*/
protected function fetchObject($cursor = null, $class = 'stdClass')
{
return sqlsrv_fetch_object($cursor ? $cursor : $this->cursor, $class);
return sqlsrv_fetch_object($cursor ?: $this->cursor, $class);
}
/**
@ -1007,8 +1007,8 @@ class SqlsrvDriver extends DatabaseDriver
$this->connect();
$table = $this->replacePrefix((string) $table);
$sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS" . " WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" .
" ORDER BY ORDINAL_POSITION";
$sql = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS' . " WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" .
' ORDER BY ORDINAL_POSITION';
$this->setQuery($sql);
return (bool) $this->loadResult();

View File

@ -416,10 +416,10 @@ class SqlsrvQuery extends DatabaseQuery implements PreparableInterface
}
// Transform $columns into an array for filtering purposes
is_string($columns) && $columns = explode(',', str_replace(" ", "", $columns));
is_string($columns) && $columns = explode(',', str_replace(' ', '', $columns));
// Get the _formatted_ FROM string and remove everything except `table AS alias`
$fromStr = str_replace(array("[","]"), "", str_replace("#__", $this->db->getPrefix(), str_replace("FROM ", "", (string) $this->from)));
$fromStr = str_replace(array('[', ']'), '', str_replace('#__', $this->db->getPrefix(), str_replace('FROM ', '', (string) $this->from)));
// Start setting up an array of alias => table
list($table, $alias) = preg_split("/\sAS\s/i", $fromStr);
@ -429,14 +429,14 @@ class SqlsrvQuery extends DatabaseQuery implements PreparableInterface
foreach ($tmpCols as $name => $type)
{
$cols[] = $alias . "." . $name;
$cols[] = $alias . '.' . $name;
}
// Now we need to get all tables from any joins
// Go through all joins and add them to the tables array
foreach ($this->join as $join)
{
$joinTbl = str_replace("#__", $this->db->getPrefix(), str_replace("]", "", preg_replace("/.*(#.+\sAS\s[^\s]*).*/i", "$1", (string) $join)));
$joinTbl = str_replace('#__', $this->db->getPrefix(), str_replace(']', '', preg_replace("/.*(#.+\sAS\s[^\s]*).*/i", '$1', (string) $join)));
list($table, $alias) = preg_split("/\sAS\s/i", $joinTbl);
@ -444,26 +444,26 @@ class SqlsrvQuery extends DatabaseQuery implements PreparableInterface
foreach ($tmpCols as $name => $tmpColType)
{
array_push($cols, $alias . "." . $name);
$cols[] = $alias . '.' . $name;
}
}
$selectStr = str_replace("SELECT ", "", (string) $this->select);
$selectStr = str_replace('SELECT ', '', (string) $this->select);
// Remove any functions (e.g. COUNT(), SUM(), CONCAT())
$selectCols = preg_replace("/([^,]*\([^\)]*\)[^,]*,?)/", "", $selectStr);
$selectCols = preg_replace("/([^,]*\([^\)]*\)[^,]*,?)/", '', $selectStr);
// Remove any "as alias" statements
$selectCols = preg_replace("/(\sas\s[^,]*)/i", "", $selectCols);
$selectCols = preg_replace("/(\sas\s[^,]*)/i", '', $selectCols);
// Remove any extra commas
$selectCols = preg_replace("/,{2,}/", ",", $selectCols);
$selectCols = preg_replace('/,{2,}/', ',', $selectCols);
// Remove any trailing commas and all whitespaces
$selectCols = trim(str_replace(" ", "", preg_replace("/,?$/", "", $selectCols)));
$selectCols = trim(str_replace(' ', '', preg_replace('/,?$/', '', $selectCols)));
// Get an array to compare against
$selectCols = explode(",", $selectCols);
$selectCols = explode(',', $selectCols);
// Find all alias.* and fill with proper table column names
foreach ($selectCols as $key => $aliasColName)
@ -471,7 +471,7 @@ class SqlsrvQuery extends DatabaseQuery implements PreparableInterface
if (preg_match("/.+\*/", $aliasColName, $match))
{
// Grab the table alias minus the .*
$aliasStar = preg_replace("/(.+)\.\*/", "$1", $aliasColName);
$aliasStar = preg_replace("/(.+)\.\*/", '$1', $aliasColName);
// Unset the array key
unset($selectCols[$key]);

View File

@ -240,7 +240,8 @@ class Container implements ContainerInterface
* @param string $resourceName The class name to build.
* @param boolean $shared True to create a shared resource.
*
* @return mixed An object if the class exists and false otherwise
* @return object|false Instance of class specified by $resourceName with all dependencies injected.
* Returns an object if the class exists and false otherwise
*
* @since 1.0
* @throws DependencyResolutionException if the object could not be built (due to missing information)
@ -251,14 +252,14 @@ class Container implements ContainerInterface
$key = $this->resolveAlias($resourceName);
if (in_array($key, $buildStack))
if (in_array($key, $buildStack, true))
{
$buildStack = [];
throw new DependencyResolutionException("Can't resolve circular dependency");
}
array_push($buildStack, $key);
$buildStack[] = $key;
if ($this->has($key))
{
@ -288,7 +289,8 @@ class Container implements ContainerInterface
$constructor = $reflection->getConstructor();
if (is_null($constructor))
// If there are no parameters, just return a new object.
if ($constructor === null)
{
// There is no constructor, just return a new object.
$callback = function () use ($key)
@ -319,7 +321,8 @@ class Container implements ContainerInterface
*
* @param string $resourceName The class name to build.
*
* @return object Instance of class specified by $resourceName with all dependencies injected.
* @return object|false Instance of class specified by $resourceName with all dependencies injected.
* Returns an object if the class exists and false otherwise
*
* @since 1.0
*/
@ -341,19 +344,20 @@ class Container implements ContainerInterface
}
/**
* Extend a defined service Closure by wrapping the existing one with a new Closure. This
* works very similar to a decorator pattern. Note that this only works on service Closures
* Extend a defined service Closure by wrapping the existing one with a new callable function.
*
* This works very similar to a decorator pattern. Note that this only works on service Closures
* that have been defined in the current Provider, not parent providers.
*
* @param string $resourceName The unique identifier for the Closure or property.
* @param \Closure $callable A Closure to wrap the original service Closure.
* @param callable $callable A callable to wrap the original service Closure.
*
* @return void
*
* @since 1.0
* @throws \InvalidArgumentException
*/
public function extend($resourceName, \Closure $callable)
public function extend($resourceName, callable $callable)
{
$key = $this->resolveAlias($resourceName);
$resource = $this->getResource($key, true);
@ -386,7 +390,7 @@ class Container implements ContainerInterface
$dependencyVarName = $param->getName();
// If we have a dependency, that means it has been type-hinted.
if (!is_null($dependency))
if ($dependency !== null)
{
$dependencyClassName = $dependency->getName();
@ -438,11 +442,14 @@ class Container implements ContainerInterface
{
$key = $this->resolveAlias($key);
if ($this->has($key) && $this->isProtected($key))
$hasKey = $this->has($key);
if ($hasKey && $this->isProtected($key))
{
throw new ProtectedKeyException(sprintf("Key %s is protected and can't be overwritten.", $key));
}
elseif ($this->has($key) && $value === null)
if ($value === null && $hasKey)
{
unset($this->resources[$key]);
@ -502,15 +509,20 @@ class Container implements ContainerInterface
*/
public function getResource($key, $bail = false)
{
if (isset($this->resources[$key]))
$key = $this->resolveAlias($key);
$raw = $this->getRaw($key);
if ($raw === null)
{
return $this->resources[$key];
}
elseif ($this->parent instanceof Container)
if ($this->parent instanceof Container)
{
return $this->parent->getResource($key);
}
elseif ($this->parent instanceof ContainerInterface && $this->parent->has($key))
if ($this->parent instanceof ContainerInterface && $this->parent->has($key))
{
return new Resource($this, $this->parent->get($key), Resource::SHARE | Resource::PROTECT);
}

View File

@ -99,8 +99,8 @@ class Resource
public function __construct(Container $container, $value, $mode = 0)
{
$this->container = $container;
$this->shared = ($mode & self::SHARE) == self::SHARE;
$this->protected = ($mode & self::PROTECT) == self::PROTECT;
$this->shared = ($mode & self::SHARE) === self::SHARE;
$this->protected = ($mode & self::PROTECT) === self::PROTECT;
if (is_callable($value))
{
@ -172,13 +172,13 @@ class Resource
{
if ($this->instance === null)
{
$this->instance = call_user_func($callable, $this->container);
$this->instance = $callable($this->container);
}
return $this->instance;
}
return call_user_func($callable, $this->container);
return $callable($this->container);
}
/**

View File

@ -20,39 +20,49 @@ class UriHelper
/**
* Does a UTF-8 safe version of PHP parse_url function
*
* @param string $url URL to parse
* @param string $url URL to parse
* @param integer $component Retrieve just a specific URL component
*
* @return mixed Associative array or false if badly formed URL.
*
* @link https://secure.php.net/manual/en/function.parse-url.php
* @since 1.0
*/
public static function parse_url($url)
public static function parse_url($url, $component = -1)
{
$result = false;
// Build arrays of values we need to decode before parsing
$entities = ['%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%24', '%2C', '%2F', '%3F', '%23', '%5B', '%5D'];
$replacements = ['!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "$", ",", "/", "?", "#", "[", "]"];
// Create encoded URL with special URL characters decoded so it can be parsed
// All other characters will be encoded
$encodedURL = str_replace($entities, $replacements, urlencode($url));
// Parse the encoded URL
$encodedParts = parse_url($encodedURL);
// Now, decode each value of the resulting array
if ($encodedParts)
// If no UTF-8 chars in the url just parse it using php native parse_url which is faster.
if (utf8_decode($url) === $url)
{
$result = [];
foreach ($encodedParts as $key => $value)
{
$result[$key] = urldecode(str_replace($replacements, $entities, $value));
}
return parse_url($url, $component);
}
return $result;
// URL with UTF-8 chars in the url.
// Build the reserved uri encoded characters map.
$reservedUriCharactersMap = [
'%21' => '!',
'%2A' => '*',
'%27' => '\'',
'%28' => '(',
'%29' => ')',
'%3B' => ';',
'%3A' => ':',
'%40' => '@',
'%26' => '&',
'%3D' => '=',
'%24' => '$',
'%2C' => ',',
'%2F' => '/',
'%3F' => '?',
'%23' => '#',
'%5B' => '[',
'%5D' => ']',
];
// Encode the URL (so UTF-8 chars are encoded), revert the encoding in the reserved uri characters and parse the url.
$parts = parse_url(strtr(urlencode($url), $reservedUriCharactersMap), $component);
// With a well formed url decode the url (so UTF-8 chars are decoded).
return $parts ? array_map('urldecode', $parts) : $parts;
}
}

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -51,7 +51,7 @@ if (!is_callable('RandomCompat_strlen')) {
);
}
return mb_strlen($binary_string, '8bit');
return (int) mb_strlen($binary_string, '8bit');
}
} else {
@ -73,7 +73,7 @@ if (!is_callable('RandomCompat_strlen')) {
'RandomCompat_strlen() expects a string'
);
}
return strlen($binary_string);
return (int) strlen($binary_string);
}
}
}
@ -118,7 +118,7 @@ if (!is_callable('RandomCompat_substr')) {
* mb_substr($str, 0, NULL, '8bit') returns an empty string on
* PHP 5.3, so we have to find the length ourselves.
*/
$length = RandomCompat_strlen($length) - $start;
$length = RandomCompat_strlen($binary_string) - $start;
} elseif (!is_int($length)) {
throw new TypeError(
'RandomCompat_substr(): Third argument should be an integer, or omitted'
@ -130,10 +130,10 @@ if (!is_callable('RandomCompat_substr')) {
return '';
}
if ($start > RandomCompat_strlen($binary_string)) {
return false;
return '';
}
return mb_substr($binary_string, $start, $length, '8bit');
return (string) mb_substr($binary_string, $start, $length, '8bit');
}
} else {
@ -172,10 +172,10 @@ if (!is_callable('RandomCompat_substr')) {
);
}
return substr($binary_string, $start, $length);
return (string) substr($binary_string, $start, $length);
}
return substr($binary_string, $start);
return (string) substr($binary_string, $start);
}
}
}

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -40,13 +40,15 @@ if (!is_callable('RandomCompat_intval')) {
* @param int|float $number The number we want to convert to an int
* @param boolean $fail_open Set to true to not throw an exception
*
* @return int (or float if $fail_open)
* @return float|int
*
* @throws TypeError
*/
function RandomCompat_intval($number, $fail_open = false)
{
if (is_numeric($number)) {
if (is_int($number) || is_float($number)) {
$number += 0;
} elseif (is_numeric($number)) {
$number += 0;
}
@ -60,12 +62,13 @@ if (!is_callable('RandomCompat_intval')) {
$number = (int) $number;
}
if (is_int($number) || $fail_open) {
return $number;
if (is_int($number)) {
return (int) $number;
} elseif (!$fail_open) {
throw new TypeError(
'Expected an integer.'
);
}
throw new TypeError(
'Expected an integer.'
);
return $number;
}
}

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,12 +3,12 @@
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
* @version 2.0.4
* @released 2016-11-07
* @version 2.0.10
* @released 2017-03-13
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -44,172 +44,180 @@ if (!defined('PHP_VERSION_ID')) {
/**
* PHP 7.0.0 and newer have these functions natively.
*/
if (PHP_VERSION_ID < 70000) {
if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
define('RANDOM_COMPAT_READ_BUFFER', 8);
if (PHP_VERSION_ID >= 70000) {
return;
}
if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
define('RANDOM_COMPAT_READ_BUFFER', 8);
}
$RandomCompatDIR = dirname(__FILE__);
require_once $RandomCompatDIR . '/byte_safe_strings.php';
require_once $RandomCompatDIR . '/cast_to_int.php';
require_once $RandomCompatDIR . '/error_polyfill.php';
if (!is_callable('random_bytes')) {
/**
* PHP 5.2.0 - 5.6.x way to implement random_bytes()
*
* We use conditional statements here to define the function in accordance
* to the operating environment. It's a micro-optimization.
*
* In order of preference:
* 1. Use libsodium if available.
* 2. fread() /dev/urandom if available (never on Windows)
* 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)
* 4. COM('CAPICOM.Utilities.1')->GetRandom()
*
* See RATIONALE.md for our reasoning behind this particular order
*/
if (extension_loaded('libsodium')) {
// See random_bytes_libsodium.php
if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
require_once $RandomCompatDIR . '/random_bytes_libsodium.php';
} elseif (method_exists('Sodium', 'randombytes_buf')) {
require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php';
}
}
$RandomCompatDIR = dirname(__FILE__);
/**
* Reading directly from /dev/urandom:
*/
if (DIRECTORY_SEPARATOR === '/') {
// DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast
// way to exclude Windows.
$RandomCompatUrandom = true;
$RandomCompat_basedir = ini_get('open_basedir');
require_once $RandomCompatDIR.'/byte_safe_strings.php';
require_once $RandomCompatDIR.'/cast_to_int.php';
require_once $RandomCompatDIR.'/error_polyfill.php';
if (!empty($RandomCompat_basedir)) {
$RandomCompat_open_basedir = explode(
PATH_SEPARATOR,
strtolower($RandomCompat_basedir)
);
$RandomCompatUrandom = (array() !== array_intersect(
array('/dev', '/dev/', '/dev/urandom'),
$RandomCompat_open_basedir
));
$RandomCompat_open_basedir = null;
}
if (
!is_callable('random_bytes')
&&
$RandomCompatUrandom
&&
@is_readable('/dev/urandom')
) {
// Error suppression on is_readable() in case of an open_basedir
// or safe_mode failure. All we care about is whether or not we
// can read it at this point. If the PHP environment is going to
// panic over trying to see if the file can be read in the first
// place, that is not helpful to us here.
// See random_bytes_dev_urandom.php
require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php';
}
// Unset variables after use
$RandomCompat_basedir = null;
} else {
$RandomCompatUrandom = false;
}
/**
* mcrypt_create_iv()
*
* We only want to use mcypt_create_iv() if:
*
* - random_bytes() hasn't already been defined
* - the mcrypt extensions is loaded
* - One of these two conditions is true:
* - We're on Windows (DIRECTORY_SEPARATOR !== '/')
* - We're not on Windows and /dev/urandom is readabale
* (i.e. we're not in a chroot jail)
* - Special case:
* - If we're not on Windows, but the PHP version is between
* 5.6.10 and 5.6.12, we don't want to use mcrypt. It will
* hang indefinitely. This is bad.
* - If we're on Windows, we want to use PHP >= 5.3.7 or else
* we get insufficient entropy errors.
*/
if (
!is_callable('random_bytes')
&&
// Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be.
(DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307)
&&
// Prevent this code from hanging indefinitely on non-Windows;
// see https://bugs.php.net/bug.php?id=69833
(
DIRECTORY_SEPARATOR !== '/' ||
(PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)
)
&&
extension_loaded('mcrypt')
) {
// See random_bytes_mcrypt.php
require_once $RandomCompatDIR . '/random_bytes_mcrypt.php';
}
$RandomCompatUrandom = null;
/**
* This is a Windows-specific fallback, for when the mcrypt extension
* isn't loaded.
*/
if (
!is_callable('random_bytes')
&&
extension_loaded('com_dotnet')
&&
class_exists('COM')
) {
$RandomCompat_disabled_classes = preg_split(
'#\s*,\s*#',
strtolower(ini_get('disable_classes'))
);
if (!in_array('com', $RandomCompat_disabled_classes)) {
try {
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
// See random_bytes_com_dotnet.php
require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php';
}
} catch (com_exception $e) {
// Don't try to use it.
}
}
$RandomCompat_disabled_classes = null;
$RandomCompatCOMtest = null;
}
/**
* throw new Exception
*/
if (!is_callable('random_bytes')) {
/**
* PHP 5.2.0 - 5.6.x way to implement random_bytes()
* We don't have any more options, so let's throw an exception right now
* and hope the developer won't let it fail silently.
*
* We use conditional statements here to define the function in accordance
* to the operating environment. It's a micro-optimization.
*
* In order of preference:
* 1. Use libsodium if available.
* 2. fread() /dev/urandom if available (never on Windows)
* 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)
* 4. COM('CAPICOM.Utilities.1')->GetRandom()
* 5. openssl_random_pseudo_bytes() (absolute last resort)
*
* See RATIONALE.md for our reasoning behind this particular order
* @param mixed $length
* @return void
* @throws Exception
*/
if (extension_loaded('libsodium')) {
// See random_bytes_libsodium.php
if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
require_once $RandomCompatDIR.'/random_bytes_libsodium.php';
} elseif (method_exists('Sodium', 'randombytes_buf')) {
require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.php';
}
}
/**
* Reading directly from /dev/urandom:
*/
if (DIRECTORY_SEPARATOR === '/') {
// DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast
// way to exclude Windows.
$RandomCompatUrandom = true;
$RandomCompat_basedir = ini_get('open_basedir');
if (!empty($RandomCompat_basedir)) {
$RandomCompat_open_basedir = explode(
PATH_SEPARATOR,
strtolower($RandomCompat_basedir)
);
$RandomCompatUrandom = (array() !== array_intersect(
array('/dev', '/dev/', '/dev/urandom'),
$RandomCompat_open_basedir
));
$RandomCompat_open_basedir = null;
}
if (
!is_callable('random_bytes')
&&
$RandomCompatUrandom
&&
@is_readable('/dev/urandom')
) {
// Error suppression on is_readable() in case of an open_basedir
// or safe_mode failure. All we care about is whether or not we
// can read it at this point. If the PHP environment is going to
// panic over trying to see if the file can be read in the first
// place, that is not helpful to us here.
// See random_bytes_dev_urandom.php
require_once $RandomCompatDIR.'/random_bytes_dev_urandom.php';
}
// Unset variables after use
$RandomCompat_basedir = null;
} else {
$RandomCompatUrandom = false;
}
/**
* mcrypt_create_iv()
*
* We only want to use mcypt_create_iv() if:
*
* - random_bytes() hasn't already been defined
* - PHP >= 5.3.7
* - the mcrypt extensions is loaded
* - One of these two conditions is true:
* - We're on Windows (DIRECTORY_SEPARATOR !== '/')
* - We're not on Windows and /dev/urandom is readabale
* (i.e. we're not in a chroot jail)
* - Special case:
* - If we're not on Windows, but the PHP version is between
* 5.6.10 and 5.6.12, we don't want to use mcrypt. It will
* hang indefinitely. This is bad.
*/
if (
!is_callable('random_bytes')
&&
PHP_VERSION_ID >= 50307
&&
extension_loaded('mcrypt')
) {
// Prevent this code from hanging indefinitely on non-Windows;
// see https://bugs.php.net/bug.php?id=69833
if (
DIRECTORY_SEPARATOR !== '/' ||
(PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613)
) {
// See random_bytes_mcrypt.php
require_once $RandomCompatDIR.'/random_bytes_mcrypt.php';
}
}
$RandomCompatUrandom = null;
/**
* This is a Windows-specific fallback, for when the mcrypt extension
* isn't loaded.
*/
if (
!is_callable('random_bytes')
&&
extension_loaded('com_dotnet')
&&
class_exists('COM')
) {
$RandomCompat_disabled_classes = preg_split(
'#\s*,\s*#',
strtolower(ini_get('disable_classes'))
function random_bytes($length)
{
unset($length); // Suppress "variable not used" warnings.
throw new Exception(
'There is no suitable CSPRNG installed on your system'
);
if (!in_array('com', $RandomCompat_disabled_classes)) {
try {
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
// See random_bytes_com_dotnet.php
require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php';
}
} catch (com_exception $e) {
// Don't try to use it.
}
}
$RandomCompat_disabled_classes = null;
$RandomCompatCOMtest = null;
}
/**
* throw new Exception
*/
if (!is_callable('random_bytes')) {
/**
* We don't have any more options, so let's throw an exception right now
* and hope the developer won't let it fail silently.
*/
function random_bytes($length)
{
throw new Exception(
'There is no suitable CSPRNG installed on your system'
);
}
}
}
if (!is_callable('random_int')) {
require_once $RandomCompatDIR.'/random_int.php';
}
$RandomCompatDIR = null;
}
if (!is_callable('random_int')) {
require_once $RandomCompatDIR . '/random_int.php';
}
$RandomCompatDIR = null;

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -55,6 +55,11 @@ if (!is_callable('random_bytes')) {
}
$buf = '';
if (!class_exists('COM')) {
throw new Error(
'COM does not exist'
);
}
$util = new COM('CAPICOM.Utilities.1');
$execCount = 0;

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -104,33 +104,50 @@ if (!is_callable('random_bytes')) {
* page load.
*/
if (!empty($fp)) {
/**
* @var int
*/
$remaining = $bytes;
/**
* @var string|bool
*/
$buf = '';
/**
* We use fread() in a loop to protect against partial reads
*/
do {
/**
* @var string|bool
*/
$read = fread($fp, $remaining);
if ($read === false) {
/**
* We cannot safely read from the file. Exit the
* do-while loop and trigger the exception condition
*/
$buf = false;
break;
if (!is_string($read)) {
if ($read === false) {
/**
* We cannot safely read from the file. Exit the
* do-while loop and trigger the exception condition
*
* @var string|bool
*/
$buf = false;
break;
}
}
/**
* Decrease the number of bytes returned from remaining
*/
$remaining -= RandomCompat_strlen($read);
$buf .= $read;
/**
* @var string|bool
*/
$buf = $buf . $read;
} while ($remaining > 0);
/**
* Is our result valid?
*/
if ($buf !== false) {
if (is_string($buf)) {
if (RandomCompat_strlen($buf) === $bytes) {
/**
* Return our random entropy buffer here:

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -56,12 +56,16 @@ if (!is_callable('random_bytes')) {
);
}
/**
* @var string
*/
$buf = '';
/**
* \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
* generated in one invocation.
*/
if ($bytes > 2147483647) {
$buf = '';
for ($i = 0; $i < $bytes; $i += 1073741824) {
$n = ($bytes - $i) > 1073741824
? 1073741824
@ -69,10 +73,10 @@ if (!is_callable('random_bytes')) {
$buf .= Sodium::randombytes_buf($n);
}
} else {
$buf = Sodium::randombytes_buf($bytes);
$buf .= Sodium::randombytes_buf($bytes);
}
if ($buf !== false) {
if (is_string($buf)) {
if (RandomCompat_strlen($buf) === $bytes) {
return $buf;
}

View File

@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,191 +1,190 @@
<?php
/**
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Fetch a random integer between $min and $max inclusive
*
* @param int $min
* @param int $max
*
* @throws Exception
*
* @return int
*/
function random_int($min, $max)
{
if (!is_callable('random_int')) {
/**
* Type and input logic checks
*
* If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
* (non-inclusive), it will sanely cast it to an int. If you it's equal to
* ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
* lose precision, so the <= and => operators might accidentally let a float
* through.
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
try {
$min = RandomCompat_intval($min);
} catch (TypeError $ex) {
throw new TypeError(
'random_int(): $min must be an integer'
);
}
try {
$max = RandomCompat_intval($max);
} catch (TypeError $ex) {
throw new TypeError(
'random_int(): $max must be an integer'
);
}
/**
* Now that we've verified our weak typing system has given us an integer,
* let's validate the logic then we can move forward with generating random
* integers along a given range.
*/
if ($min > $max) {
throw new Error(
'Minimum value must be less than or equal to the maximum value'
);
}
if ($max === $min) {
return $min;
}
/**
* Initialize variables to 0
*
* We want to store:
* $bytes => the number of random bytes we need
* $mask => an integer bitmask (for use with the &) operator
* so we can minimize the number of discards
* Fetch a random integer between $min and $max inclusive
*
* @param int $min
* @param int $max
*
* @throws Exception
*
* @return int
*/
$attempts = $bits = $bytes = $mask = $valueShift = 0;
function random_int($min, $max)
{
/**
* Type and input logic checks
*
* If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
* (non-inclusive), it will sanely cast it to an int. If you it's equal to
* ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats
* lose precision, so the <= and => operators might accidentally let a float
* through.
*/
/**
* At this point, $range is a positive number greater than 0. It might
* overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
* a float and we will lose some precision.
*/
$range = $max - $min;
try {
$min = RandomCompat_intval($min);
} catch (TypeError $ex) {
throw new TypeError(
'random_int(): $min must be an integer'
);
}
/**
* Test for integer overflow:
*/
if (!is_int($range)) {
try {
$max = RandomCompat_intval($max);
} catch (TypeError $ex) {
throw new TypeError(
'random_int(): $max must be an integer'
);
}
/**
* Still safely calculate wider ranges.
* Provided by @CodesInChaos, @oittaa
*
* @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
*
* We use ~0 as a mask in this case because it generates all 1s
*
* @ref https://eval.in/400356 (32-bit)
* @ref http://3v4l.org/XX9r5 (64-bit)
* Now that we've verified our weak typing system has given us an integer,
* let's validate the logic then we can move forward with generating random
* integers along a given range.
*/
$bytes = PHP_INT_SIZE;
$mask = ~0;
if ($min > $max) {
throw new Error(
'Minimum value must be less than or equal to the maximum value'
);
}
} else {
if ($max === $min) {
return $min;
}
/**
* $bits is effectively ceil(log($range, 2)) without dealing with
* type juggling
* Initialize variables to 0
*
* We want to store:
* $bytes => the number of random bytes we need
* $mask => an integer bitmask (for use with the &) operator
* so we can minimize the number of discards
*/
while ($range > 0) {
if ($bits % 8 === 0) {
++$bytes;
$attempts = $bits = $bytes = $mask = $valueShift = 0;
/**
* At this point, $range is a positive number greater than 0. It might
* overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to
* a float and we will lose some precision.
*/
$range = $max - $min;
/**
* Test for integer overflow:
*/
if (!is_int($range)) {
/**
* Still safely calculate wider ranges.
* Provided by @CodesInChaos, @oittaa
*
* @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435
*
* We use ~0 as a mask in this case because it generates all 1s
*
* @ref https://eval.in/400356 (32-bit)
* @ref http://3v4l.org/XX9r5 (64-bit)
*/
$bytes = PHP_INT_SIZE;
$mask = ~0;
} else {
/**
* $bits is effectively ceil(log($range, 2)) without dealing with
* type juggling
*/
while ($range > 0) {
if ($bits % 8 === 0) {
++$bytes;
}
++$bits;
$range >>= 1;
$mask = $mask << 1 | 1;
}
++$bits;
$range >>= 1;
$mask = $mask << 1 | 1;
}
$valueShift = $min;
}
/**
* Now that we have our parameters set up, let's begin generating
* random integers until one falls between $min and $max
*/
do {
/**
* The rejection probability is at most 0.5, so this corresponds
* to a failure probability of 2^-128 for a working RNG
*/
if ($attempts > 128) {
throw new Exception(
'random_int: RNG is broken - too many rejections'
);
$valueShift = $min;
}
/**
* Let's grab the necessary number of random bytes
*/
$randomByteString = random_bytes($bytes);
if ($randomByteString === false) {
throw new Exception(
'Random number generator failure'
);
}
/**
* Let's turn $randomByteString into an integer
*
* This uses bitwise operators (<< and |) to build an integer
* out of the values extracted from ord()
*
* Example: [9F] | [6D] | [32] | [0C] =>
* 159 + 27904 + 3276800 + 201326592 =>
* 204631455
*/
$val = 0;
for ($i = 0; $i < $bytes; ++$i) {
$val |= ord($randomByteString[$i]) << ($i * 8);
}
/**
* Apply mask
* Now that we have our parameters set up, let's begin generating
* random integers until one falls between $min and $max
*/
$val &= $mask;
$val += $valueShift;
do {
/**
* The rejection probability is at most 0.5, so this corresponds
* to a failure probability of 2^-128 for a working RNG
*/
if ($attempts > 128) {
throw new Exception(
'random_int: RNG is broken - too many rejections'
);
}
++$attempts;
/**
* If $val overflows to a floating point number,
* ... or is larger than $max,
* ... or smaller than $min,
* then try again.
*/
} while (!is_int($val) || $val > $max || $val < $min);
/**
* Let's grab the necessary number of random bytes
*/
$randomByteString = random_bytes($bytes);
return (int) $val;
/**
* Let's turn $randomByteString into an integer
*
* This uses bitwise operators (<< and |) to build an integer
* out of the values extracted from ord()
*
* Example: [9F] | [6D] | [32] | [0C] =>
* 159 + 27904 + 3276800 + 201326592 =>
* 204631455
*/
$val &= 0;
for ($i = 0; $i < $bytes; ++$i) {
$val |= ord($randomByteString[$i]) << ($i * 8);
}
/**
* Apply mask
*/
$val &= $mask;
$val += $valueShift;
++$attempts;
/**
* If $val overflows to a floating point number,
* ... or is larger than $max,
* ... or smaller than $min,
* then try again.
*/
} while (!is_int($val) || $val > $max || $val < $min);
return (int)$val;
}
}

View File

@ -673,7 +673,7 @@ class PHPMailer
*
* @var string
*/
const LE = "\r\n";
protected static $LE = "\r\n";
/**
* The maximum line length allowed by RFC 2822 section 2.1.1
@ -1258,6 +1258,33 @@ class PHPMailer
*/
public function preSend()
{
if ('smtp' == $this->Mailer or
('mail' == $this->Mailer and stripos(PHP_OS, 'WIN') === 0)
) {
//SMTP mandates RFC-compliant line endings
//and it's also used with mail() on Windows
static::setLE("\r\n");
} else {
//Maintain backward compatibility with legacy Linux command line mailers
static::setLE(PHP_EOL);
}
//Check for buggy PHP versions that add a header with an incorrect line break
if (ini_get('mail.add_x_header') == 1
and 'mail' == $this->Mailer
and stripos(PHP_OS, 'WIN') === 0
and ((version_compare(PHP_VERSION, '7.0.0', '>=')
and version_compare(PHP_VERSION, '7.0.17', '<'))
or (version_compare(PHP_VERSION, '7.1.0', '>=')
and version_compare(PHP_VERSION, '7.1.3', '<')))
) {
trigger_error(
'Your version of PHP is affected by a bug that may result in corrupted messages.' .
' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
E_USER_WARNING
);
}
try {
$this->error_count = 0; // Reset errors
$this->mailHeader = '';
@ -1334,8 +1361,8 @@ class PHPMailer
$this->encodeHeader($this->secureHeader($this->Subject)),
$this->MIMEBody
);
$this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::LE .
$this->fixEOL($header_dkim) . static::LE;
$this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::$LE .
static::normalizeBreaks($header_dkim) . static::$LE;
}
return true;
} catch (Exception $exc) {
@ -1864,7 +1891,7 @@ class PHPMailer
foreach ($addr as $address) {
$addresses[] = $this->addrFormat($address);
}
return $type . ': ' . implode(', ', $addresses) . static::LE;
return $type . ': ' . implode(', ', $addresses) . static::$LE;
}
/**
@ -1901,24 +1928,24 @@ class PHPMailer
public function wrapText($message, $length, $qp_mode = false)
{
if ($qp_mode) {
$soft_break = sprintf(' =%s', static::LE);
$soft_break = sprintf(' =%s', static::$LE);
} else {
$soft_break = static::LE;
$soft_break = static::$LE;
}
// If utf-8 encoding is used, we will need to make sure we don't
// split multibyte characters when we wrap
$is_utf8 = (strtolower($this->CharSet) == 'utf-8');
$lelen = strlen(static::LE);
$crlflen = strlen(static::LE);
$lelen = strlen(static::$LE);
$crlflen = strlen(static::$LE);
$message = $this->fixEOL($message);
$message = static::normalizeBreaks($message);
//Remove a trailing line break
if (substr($message, -$lelen) == static::LE) {
if (substr($message, -$lelen) == static::$LE) {
$message = substr($message, 0, -$lelen);
}
//Split message into lines
$lines = explode(static::LE, $message);
$lines = explode(static::$LE, $message);
//Message will be rebuilt in here
$message = '';
foreach ($lines as $line) {
@ -1941,7 +1968,7 @@ class PHPMailer
$part = substr($word, 0, $len);
$word = substr($word, $len);
$buf .= ' ' . $part;
$message .= $buf . sprintf('=%s', static::LE);
$message .= $buf . sprintf('=%s', static::$LE);
} else {
$message .= $buf . $soft_break;
}
@ -1963,7 +1990,7 @@ class PHPMailer
$word = substr($word, $len);
if (strlen($word) > 0) {
$message .= $part . sprintf('=%s', static::LE);
$message .= $part . sprintf('=%s', static::$LE);
} else {
$buf = $part;
}
@ -1982,7 +2009,7 @@ class PHPMailer
}
$firstword = false;
}
$message .= $buf . static::LE;
$message .= $buf . static::$LE;
}
return $message;
@ -2204,7 +2231,7 @@ class PHPMailer
}
if ('mail' != $this->Mailer) {
$result .= static::LE;
$result .= static::$LE;
}
return $result;
@ -2220,7 +2247,7 @@ class PHPMailer
*/
public function getSentMIMEMessage()
{
return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::LE . static::LE . $this->MIMEBody;
return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::$LE . static::$LE . $this->MIMEBody;
}
/**
@ -2250,7 +2277,7 @@ class PHPMailer
$this->boundary[3] = 'b3_' . $this->uniqueid;
if ($this->sign_key_file) {
$body .= $this->getMailMIME() . static::LE;
$body .= $this->getMailMIME() . static::$LE;
}
$this->setWordWrap();
@ -2283,20 +2310,20 @@ class PHPMailer
$altBodyEncoding = 'quoted-printable';
}
//Use this as a preamble in all multipart message types
$mimepre = "This is a multi-part message in MIME format." . static::LE;
$mimepre = "This is a multi-part message in MIME format." . static::$LE;
switch ($this->message_type) {
case 'inline':
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[1]);
break;
case 'attach':
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
case 'inline_attach':
@ -2304,26 +2331,26 @@ class PHPMailer
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', 'multipart/related;');
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[2]);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
case 'alt':
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
if (!empty($this->Ical)) {
$body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
$body .= $this->encodeString($this->Ical, $this->Encoding);
$body .= static::LE;
$body .= static::$LE;
}
$body .= $this->endBoundary($this->boundary[1]);
break;
@ -2331,16 +2358,16 @@ class PHPMailer
$body .= $mimepre;
$body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', 'multipart/related;');
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[2]);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->endBoundary($this->boundary[1]);
break;
case 'alt_attach':
@ -2348,15 +2375,15 @@ class PHPMailer
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', 'multipart/alternative;');
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->endBoundary($this->boundary[2]);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
case 'alt_inline_attach':
@ -2364,21 +2391,21 @@ class PHPMailer
$body .= $this->textLine('--' . $this->boundary[1]);
$body .= $this->headerLine('Content-Type', 'multipart/alternative;');
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->textLine('--' . $this->boundary[2]);
$body .= $this->headerLine('Content-Type', 'multipart/related;');
$body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
$body .= static::LE;
$body .= static::$LE;
$body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
$body .= $this->encodeString($this->Body, $bodyEncoding);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('inline', $this->boundary[3]);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->endBoundary($this->boundary[2]);
$body .= static::LE;
$body .= static::$LE;
$body .= $this->attachAll('attachment', $this->boundary[1]);
break;
default:
@ -2428,7 +2455,7 @@ class PHPMailer
@unlink($signed);
//The message returned by openssl contains both headers and body, so need to split them up
$parts = explode("\n\n", $body, 2);
$this->MIMEHeader .= $parts[0] . static::LE . static::LE;
$this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
$body = $parts[1];
} else {
@unlink($file);
@ -2469,12 +2496,12 @@ class PHPMailer
}
$result .= $this->textLine('--' . $boundary);
$result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
$result .= static::LE;
$result .= static::$LE;
// RFC1341 part 5 says 7bit is assumed if not specified
if ('7bit' != $encoding) {
$result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
}
$result .= static::LE;
$result .= static::$LE;
return $result;
}
@ -2488,7 +2515,7 @@ class PHPMailer
*/
protected function endBoundary($boundary)
{
return static::LE . '--' . $boundary . '--' . static::LE;
return static::$LE . '--' . $boundary . '--' . static::$LE;
}
/**
@ -2524,7 +2551,7 @@ class PHPMailer
*/
public function headerLine($name, $value)
{
return $name . ': ' . $value . static::LE;
return $name . ': ' . $value . static::$LE;
}
/**
@ -2536,7 +2563,7 @@ class PHPMailer
*/
public function textLine($value)
{
return $value . static::LE;
return $value . static::$LE;
}
/**
@ -2646,29 +2673,29 @@ class PHPMailer
}
$cidUniq[$cid] = true;
$mime[] = sprintf('--%s%s', $boundary, static::LE);
$mime[] = sprintf('--%s%s', $boundary, static::$LE);
//Only include a filename property if we have one
if (!empty($name)) {
$mime[] = sprintf(
'Content-Type: %s; name="%s"%s',
$type,
$this->encodeHeader($this->secureHeader($name)),
static::LE
static::$LE
);
} else {
$mime[] = sprintf(
'Content-Type: %s%s',
$type,
static::LE
static::$LE
);
}
// RFC1341 part 5 says 7bit is assumed if not specified
if ('7bit' != $encoding) {
$mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, static::LE);
$mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, static::$LE);
}
if ('inline' == $disposition) {
$mime[] = sprintf('Content-ID: <%s>%s', $cid, static::LE);
$mime[] = sprintf('Content-ID: <%s>%s', $cid, static::$LE);
}
// If a filename contains any of these chars, it should be quoted,
@ -2682,7 +2709,7 @@ class PHPMailer
'Content-Disposition: %s; filename="%s"%s',
$disposition,
$encoded_name,
static::LE . static::LE
static::$LE . static::$LE
);
} else {
if (!empty($encoded_name)) {
@ -2690,18 +2717,18 @@ class PHPMailer
'Content-Disposition: %s; filename=%s%s',
$disposition,
$encoded_name,
static::LE . static::LE
static::$LE . static::$LE
);
} else {
$mime[] = sprintf(
'Content-Disposition: %s%s',
$disposition,
static::LE . static::LE
static::$LE . static::$LE
);
}
}
} else {
$mime[] = static::LE;
$mime[] = static::$LE;
}
// Encode as string attachment
@ -2710,18 +2737,18 @@ class PHPMailer
if ($this->isError()) {
return '';
}
$mime[] = static::LE;
$mime[] = static::$LE;
} else {
$mime[] = $this->encodeFile($path, $encoding);
if ($this->isError()) {
return '';
}
$mime[] = static::LE;
$mime[] = static::$LE;
}
}
}
$mime[] = sprintf('--%s--%s', $boundary, static::LE);
$mime[] = sprintf('--%s--%s', $boundary, static::$LE);
return implode('', $mime);
}
@ -2765,14 +2792,14 @@ class PHPMailer
$encoded = '';
switch (strtolower($encoding)) {
case 'base64':
$encoded = chunk_split(base64_encode($str), 76, static::LE);
$encoded = chunk_split(base64_encode($str), 76, static::$LE);
break;
case '7bit':
case '8bit':
$encoded = $this->fixEOL($str);
$encoded = static::normalizeBreaks($str);
// Make sure it ends with a line break
if (substr($encoded, -(strlen(static::LE))) != static::LE) {
$encoded .= static::LE;
if (substr($encoded, -(strlen(static::$LE))) != static::$LE) {
$encoded .= static::$LE;
}
break;
case 'binary':
@ -2849,11 +2876,11 @@ class PHPMailer
$encoding = 'Q';
$encoded = $this->encodeQ($str, $position);
$encoded = $this->wrapText($encoded, $maxlen, true);
$encoded = str_replace('=' . static::LE, "\n", trim($encoded));
$encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
}
$encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
$encoded = trim(str_replace("\n", static::LE, $encoded));
$encoded = trim(str_replace("\n", static::$LE, $encoded));
return $encoded;
}
@ -2903,7 +2930,7 @@ class PHPMailer
$end = '?=';
$encoded = '';
if (is_null($linebreak)) {
$linebreak = static::LE;
$linebreak = static::$LE;
}
$mb_length = mb_strlen($str, $this->CharSet);
@ -2940,7 +2967,7 @@ class PHPMailer
*/
public function encodeQP($string)
{
return quoted_printable_encode($string);
return static::normalizeBreaks(quoted_printable_encode($string));
}
/**
@ -2964,12 +2991,12 @@ class PHPMailer
break;
/**
* RFC 2047 section 5.2.
* intentional fall-through - build the $pattern without including delimiters and []
*
* @noinspection PhpMissingBreakStatementInspection
* Build $pattern without including delimiters and []
*/
/** @noinspection PhpMissingBreakStatementInspection */
case 'comment':
$pattern = '\(\)"';
$pattern = '\(\)"';
/* Intentional fall through */
case 'text':
default:
// RFC 2047 section 5.1
@ -3365,25 +3392,6 @@ class PHPMailer
return ($this->error_count > 0);
}
/**
* Ensure consistent line endings in a string.
* Changes every end of line from LE, CR or LF to static::LE.
*
* @param string $str String to fixEOL
*
* @return string
*/
public function fixEOL($str)
{
// Normalise to \n
$nstr = str_replace(["\r\n", "\r"], "\n", $str);
// Now convert LE as needed
if ("\n" !== static::LE) {
$nstr = str_replace("\n", static::LE, $nstr);
}
return $nstr;
}
/**
* Add a custom header.
* $name value can be overloaded to contain
@ -3511,7 +3519,7 @@ class PHPMailer
$this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
if (!$this->alternativeExists()) {
$this->AltBody = 'This is an HTML-only message. To view it, activate HTML in your email application.'
. static::LE;
. static::$LE;
}
return $this->Body;
}
@ -3648,6 +3656,7 @@ class PHPMailer
'rtf' => 'text/rtf',
'vcf' => 'text/vcard',
'vcard' => 'text/vcard',
'ics' => 'text/calendar',
'xml' => 'text/xml',
'xsl' => 'text/xml',
'mpeg' => 'video/mpeg',
@ -3770,17 +3779,44 @@ class PHPMailer
/**
* Normalize line breaks in a string.
* Converts UNIX LF, Mac CR and Windows LE line breaks into a single line break format.
* Defaults to LE (for message bodies) and preserves consecutive breaks.
* Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
* Defaults to CRLF (for message bodies) and preserves consecutive breaks.
*
* @param string $text
* @param string $breaktype What kind of line break to use, defaults to LE
* @param string $breaktype What kind of line break to use; defaults to static::$LE.
*
* @return string
*/
public static function normalizeBreaks($text, $breaktype = "\r\n")
public static function normalizeBreaks($text, $breaktype = null)
{
return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
if (is_null($breaktype)) {
$breaktype = static::$LE;
}
// Normalise to \n
$text = str_replace(["\r\n", "\r"], "\n", $text);
// Now convert LE as needed
if ("\n" !== static::$LE) {
$text = str_replace("\n", $breaktype, $text);
}
return $text;
}
/**
* Return the current line break format string.
*
* @return string
*/
public static function getLE()
{
return static::$LE;
}
/**
* Set the line break format string.
*/
protected static function setLE($le)
{
static::$LE = $le;
}
/**
@ -3890,7 +3926,7 @@ class PHPMailer
//by elimination, the same applies to the field name
$lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
}
$signHeader = implode("\r\n", $lines);
$signHeader = implode(static::$LE, $lines);
return $signHeader;
}
@ -3906,13 +3942,12 @@ class PHPMailer
public function DKIM_BodyC($body)
{
if (empty($body)) {
return "\r\n";
return static::$LE;
}
// Normalize line endings
$body = str_replace("\r\n", "\n", $body);
$body = str_replace("\n", "\r\n", $body);
$body = static::normalizeBreaks($body);
//Reduce multiple trailing line breaks to a single one
return rtrim($body, "\r\n")."\r\n";
return rtrim($body, "\r\n") . static::$LE;
}
/**
@ -3931,7 +3966,7 @@ class PHPMailer
$DKIMquery = 'dns/txt'; // Query method
$DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
$subject_header = "Subject: $subject";
$headers = explode(static::LE, $headers_line);
$headers = explode(static::$LE, $headers_line);
$from_header = '';
$to_header = '';
$date_header = '';
@ -3993,11 +4028,12 @@ class PHPMailer
$dkimhdrs
);
$signed = $this->DKIM_Sign($toSign);
return $dkimhdrs . $signed . "\r\n";
return static::normalizeBreaks($dkimhdrs . $signed) . static::$LE;
}
/**
* Detect if a string contains a line longer than the maximum line length allowed.
* Detect if a string contains a line longer than the maximum line length
* allowed by RFC 2822 section 2.1.1.
*
* @param string $str
*
@ -4005,8 +4041,7 @@ class PHPMailer
*/
public static function hasLineLongerThanMax($str)
{
//+2 to include LE line break for a 1000 total
return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + 2).',})/m', $str);
return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + strlen(static::$LE)).',})/m', $str);
}
/**

View File

@ -123,7 +123,7 @@ class ParseException extends RuntimeException
}
if (null !== $this->parsedFile) {
if (PHP_VERSION_ID >= 50400) {
if (\PHP_VERSION_ID >= 50400) {
$jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
} else {
$jsonOptions = 0;

View File

@ -129,6 +129,12 @@ final class HeaderSecurity
*/
public static function assertValid($value)
{
if (! is_string($value) && ! is_numeric($value)) {
throw new InvalidArgumentException(sprintf(
'Invalid header value type; must be a string or numeric; received %s',
(is_object($value) ? get_class($value) : gettype($value))
));
}
if (! self::isValid($value)) {
throw new InvalidArgumentException(sprintf(
'"%s" is not valid header value',
@ -146,6 +152,12 @@ final class HeaderSecurity
*/
public static function assertValidName($name)
{
if (! is_string($name)) {
throw new InvalidArgumentException(sprintf(
'Invalid header name type; expected string; received %s',
(is_object($name) ? get_class($name) : gettype($name))
));
}
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $name)) {
throw new InvalidArgumentException(sprintf(
'"%s" is not valid header name',

View File

@ -112,7 +112,7 @@ trait MessageTrait
*/
public function hasHeader($header)
{
return array_key_exists(strtolower($header), $this->headerNames);
return isset($this->headerNames[strtolower($header)]);
}
/**
@ -136,10 +136,8 @@ trait MessageTrait
}
$header = $this->headerNames[strtolower($header)];
$value = $this->headers[$header];
$value = is_array($value) ? $value : [$value];
return $value;
return $this->headers[$header];
}
/**
@ -189,18 +187,7 @@ trait MessageTrait
*/
public function withHeader($header, $value)
{
if (is_string($value)) {
$value = [$value];
}
if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) {
throw new InvalidArgumentException(
'Invalid header value; must be a string or array of strings'
);
}
HeaderSecurity::assertValidName($header);
self::assertValidHeaderValue($value);
$this->assertHeader($header);
$normalized = strtolower($header);
@ -208,6 +195,9 @@ trait MessageTrait
if ($new->hasHeader($header)) {
unset($new->headers[$new->headerNames[$normalized]]);
}
$value = $this->filterHeaderValue($value);
$new->headerNames[$normalized] = $header;
$new->headers[$header] = $value;
@ -233,27 +223,16 @@ trait MessageTrait
*/
public function withAddedHeader($header, $value)
{
if (is_string($value)) {
$value = [ $value ];
}
if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) {
throw new InvalidArgumentException(
'Invalid header value; must be a string or array of strings'
);
}
HeaderSecurity::assertValidName($header);
self::assertValidHeaderValue($value);
$this->assertHeader($header);
if (! $this->hasHeader($header)) {
return $this->withHeader($header, $value);
}
$normalized = strtolower($header);
$header = $this->headerNames[$normalized];
$header = $this->headerNames[strtolower($header)];
$new = clone $this;
$value = $this->filterHeaderValue($value);
$new->headers[$header] = array_merge($this->headers[$header], $value);
return $new;
}
@ -331,92 +310,28 @@ trait MessageTrait
return new Stream($stream, $modeIfNotInstance);
}
/**
* Test that an array contains only strings
*
* @param array $array
* @return bool
*/
private function arrayContainsOnlyStrings(array $array)
{
return array_reduce($array, [__CLASS__, 'filterStringValue'], true);
}
/**
* Filter a set of headers to ensure they are in the correct internal format.
*
* Used by message constructors to allow setting all initial headers at once.
*
* @param array $originalHeaders Headers to filter.
* @return array Filtered headers and names.
*/
private function filterHeaders(array $originalHeaders)
private function setHeaders(array $originalHeaders)
{
$headerNames = $headers = [];
foreach ($originalHeaders as $header => $value) {
if (! is_string($header)) {
throw new InvalidArgumentException(sprintf(
'Invalid header name; expected non-empty string, received %s',
gettype($header)
));
}
$value = $this->filterHeaderValue($value);
if (! is_array($value) && ! is_string($value) && ! is_numeric($value)) {
throw new InvalidArgumentException(sprintf(
'Invalid header value type; expected number, string, or array; received %s',
(is_object($value) ? get_class($value) : gettype($value))
));
}
if (is_array($value)) {
array_walk($value, function ($item) {
if (! is_string($item) && ! is_numeric($item)) {
throw new InvalidArgumentException(sprintf(
'Invalid header value type; expected number, string, or array; received %s',
(is_object($item) ? get_class($item) : gettype($item))
));
}
});
}
if (! is_array($value)) {
$value = [ $value ];
}
$this->assertHeader($header);
$headerNames[strtolower($header)] = $header;
$headers[$header] = $value;
}
return [$headerNames, $headers];
}
/**
* Test if a value is a string
*
* Used with array_reduce.
*
* @param bool $carry
* @param mixed $item
* @return bool
*/
private static function filterStringValue($carry, $item)
{
if (! is_string($item)) {
return false;
}
return $carry;
}
/**
* Assert that the provided header values are valid.
*
* @see http://tools.ietf.org/html/rfc7230#section-3.2
* @param string[] $values
* @throws InvalidArgumentException
*/
private static function assertValidHeaderValue(array $values)
{
array_walk($values, __NAMESPACE__ . '\HeaderSecurity::assertValid');
$this->headerNames = $headerNames;
$this->headers = $headers;
}
/**
@ -448,4 +363,33 @@ trait MessageTrait
));
}
}
/**
* @param mixed $values
* @return string[]
*/
private function filterHeaderValue($values)
{
if (! is_array($values)) {
$values = [$values];
}
return array_map(function ($value) {
HeaderSecurity::assertValid($value);
return (string) $value;
}, $values);
}
/**
* Ensure header name and values are valid.
*
* @param string $name
*
* @throws InvalidArgumentException
*/
private function assertHeader($name)
{
HeaderSecurity::assertValidName($name);
}
}

View File

@ -22,7 +22,7 @@ use Psr\Http\Message\UriInterface;
*/
class Request implements RequestInterface
{
use MessageTrait, RequestTrait;
use RequestTrait;
/**
* @param null|string|UriInterface $uri URI for the request, if any.
@ -67,9 +67,7 @@ class Request implements RequestInterface
}
$header = $this->headerNames[strtolower($header)];
$value = $this->headers[$header];
$value = is_array($value) ? $value : [$value];
return $value;
return $this->headers[$header];
}
}

View File

@ -0,0 +1,85 @@
<?php
/**
* @see http://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Diactoros\Request;
use Psr\Http\Message\RequestInterface;
use UnexpectedValueException;
use Zend\Diactoros\Request;
use Zend\Diactoros\Stream;
/**
* Serialize or deserialize request messages to/from arrays.
*
* This class provides functionality for serializing a RequestInterface instance
* to an array, as well as the reverse operation of creating a Request instance
* from an array representing a message.
*/
final class ArraySerializer
{
/**
* Serialize a request message to an array.
*
* @param RequestInterface $request
* @return array
*/
public static function toArray(RequestInterface $request)
{
return [
'method' => $request->getMethod(),
'request_target' => $request->getRequestTarget(),
'uri' => (string) $request->getUri(),
'protocol_version' => $request->getProtocolVersion(),
'headers' => $request->getHeaders(),
'body' => (string) $request->getBody(),
];
}
/**
* Deserialize a request array to a request instance.
*
* @param array $serializedRequest
* @return Request
* @throws UnexpectedValueException when cannot deserialize response
*/
public static function fromArray(array $serializedRequest)
{
try {
$uri = self::getValueFromKey($serializedRequest, 'uri');
$method = self::getValueFromKey($serializedRequest, 'method');
$body = new Stream('php://memory', 'wb+');
$body->write(self::getValueFromKey($serializedRequest, 'body'));
$headers = self::getValueFromKey($serializedRequest, 'headers');
$requestTarget = self::getValueFromKey($serializedRequest, 'request_target');
$protocolVersion = self::getValueFromKey($serializedRequest, 'protocol_version');
return (new Request($uri, $method, $body, $headers))
->withRequestTarget($requestTarget)
->withProtocolVersion($protocolVersion);
} catch (\Exception $exception) {
throw new UnexpectedValueException('Cannot deserialize request', null, $exception);
}
}
/**
* @param array $data
* @param string $key
* @param string $message
* @return mixed
* @throws UnexpectedValueException
*/
private static function getValueFromKey(array $data, $key, $message = null)
{
if (isset($data[$key])) {
return $data[$key];
}
if ($message === null) {
$message = sprintf('Missing "%s" key in serialized request', $key);
}
throw new UnexpectedValueException($message);
}
}

View File

@ -22,14 +22,11 @@ use Psr\Http\Message\UriInterface;
* the environment. As such, this trait exists to provide the common code
* between both client-side and server-side requests, and each can then
* use the headers functionality required by their implementations.
*
* @property array $headers
* @property array $headerNames
* @property StreamInterface $stream
* @method bool hasHeader(string $header)
*/
trait RequestTrait
{
use MessageTrait;
/**
* @var string
*/
@ -66,9 +63,7 @@ trait RequestTrait
$this->uri = $this->createUri($uri);
$this->stream = $this->getStream($body, 'wb+');
list($this->headerNames, $headers) = $this->filterHeaders($headers);
$this->assertHeaders($headers);
$this->headers = $headers;
$this->setHeaders($headers);
// per PSR-7: attempt to set the Host header from a provided URI if no
// Host header is provided
@ -319,18 +314,4 @@ trait RequestTrait
$host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';
return $host;
}
/**
* Ensure header names and values are valid.
*
* @param array $headers
* @throws InvalidArgumentException
*/
private function assertHeaders(array $headers)
{
foreach ($headers as $name => $headerValues) {
HeaderSecurity::assertValidName($name);
array_walk($headerValues, __NAMESPACE__ . '\HeaderSecurity::assertValid');
}
}
}

View File

@ -24,6 +24,9 @@ class Response implements ResponseInterface
{
use MessageTrait;
const MIN_STATUS_CODE_VALUE = 100;
const MAX_STATUS_CODE_VALUE = 599;
/**
* Map of standard HTTP status code/reason phrases
*
@ -42,9 +45,9 @@ class Response implements ResponseInterface
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-status',
207 => 'Multi-Status',
208 => 'Already Reported',
226 => 'IM used',
226 => 'IM Used',
// REDIRECTION CODES
300 => 'Multiple Choices',
301 => 'Moved Permanently',
@ -64,15 +67,15 @@ class Response implements ResponseInterface
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Time-out',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Large',
413 => 'Payload Too Large',
414 => 'URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Requested range not satisfiable',
416 => 'Range Not Satisfiable',
417 => 'Expectation Failed',
418 => 'I\'m a teapot',
421 => 'Misdirected Request',
@ -92,8 +95,8 @@ class Response implements ResponseInterface
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Time-out',
505 => 'HTTP Version not supported',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
508 => 'Loop Detected',
@ -122,9 +125,7 @@ class Response implements ResponseInterface
{
$this->setStatusCode($status);
$this->stream = $this->getStream($body, 'wb+');
list($this->headerNames, $headers) = $this->filterHeaders($headers);
$this->assertHeaders($headers);
$this->headers = $headers;
$this->setHeaders($headers);
}
/**
@ -161,37 +162,25 @@ class Response implements ResponseInterface
}
/**
* Validate a status code.
* Set a valid status code.
*
* @param int|string $code
* @param int $code
* @throws InvalidArgumentException on an invalid status code.
*/
private function setStatusCode($code)
{
if (! is_numeric($code)
|| is_float($code)
|| $code < 100
|| $code >= 600
|| $code < static::MIN_STATUS_CODE_VALUE
|| $code > static::MAX_STATUS_CODE_VALUE
) {
throw new InvalidArgumentException(sprintf(
'Invalid status code "%s"; must be an integer between 100 and 599, inclusive',
(is_scalar($code) ? $code : gettype($code))
'Invalid status code "%s"; must be an integer between %d and %d, inclusive',
(is_scalar($code) ? $code : gettype($code)),
static::MIN_STATUS_CODE_VALUE,
static::MAX_STATUS_CODE_VALUE
));
}
$this->statusCode = $code;
}
/**
* Ensure header names and values are valid.
*
* @param array $headers
* @throws InvalidArgumentException
*/
private function assertHeaders(array $headers)
{
foreach ($headers as $name => $headerValues) {
HeaderSecurity::assertValidName($name);
array_walk($headerValues, __NAMESPACE__ . '\HeaderSecurity::assertValid');
}
}
}

View File

@ -0,0 +1,84 @@
<?php
/**
* @see http://github.com/zendframework/zend-diactoros for the canonical source repository
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Diactoros\Response;
use Psr\Http\Message\ResponseInterface;
use UnexpectedValueException;
use Zend\Diactoros\Response;
use Zend\Diactoros\Stream;
/**
* Serialize or deserialize response messages to/from arrays.
*
* This class provides functionality for serializing a ResponseInterface instance
* to an array, as well as the reverse operation of creating a Response instance
* from an array representing a message.
*/
final class ArraySerializer
{
/**
* Serialize a response message to an array.
*
* @param ResponseInterface $response
* @return array
*/
public static function toArray(ResponseInterface $response)
{
return [
'status_code' => $response->getStatusCode(),
'reason_phrase' => $response->getReasonPhrase(),
'protocol_version' => $response->getProtocolVersion(),
'headers' => $response->getHeaders(),
'body' => (string) $response->getBody(),
];
}
/**
* Deserialize a response array to a response instance.
*
* @param array $serializedResponse
* @return Response
* @throws UnexpectedValueException when cannot deserialize response
*/
public static function fromArray(array $serializedResponse)
{
try {
$body = new Stream('php://memory', 'wb+');
$body->write(self::getValueFromKey($serializedResponse, 'body'));
$statusCode = self::getValueFromKey($serializedResponse, 'status_code');
$headers = self::getValueFromKey($serializedResponse, 'headers');
$protocolVersion = self::getValueFromKey($serializedResponse, 'protocol_version');
$reasonPhrase = self::getValueFromKey($serializedResponse, 'reason_phrase');
return (new Response($body, $statusCode, $headers))
->withProtocolVersion($protocolVersion)
->withStatus($statusCode, $reasonPhrase);
} catch (\Exception $exception) {
throw new UnexpectedValueException('Cannot deserialize response', null, $exception);
}
}
/**
* @param array $data
* @param string $key
* @param string $message
* @return mixed
* @throws UnexpectedValueException
*/
private static function getValueFromKey(array $data, $key, $message = null)
{
if (isset($data[$key])) {
return $data[$key];
}
if ($message === null) {
$message = sprintf('Missing "%s" key in serialized request', $key);
}
throw new UnexpectedValueException($message);
}
}

View File

@ -37,7 +37,7 @@ final class Serializer extends AbstractSerializer
* Parse a response from a stream.
*
* @param StreamInterface $stream
* @return ResponseInterface
* @return Response
* @throws InvalidArgumentException when the stream is not readable.
* @throws UnexpectedValueException when errors occur parsing the message.
*/

View File

@ -31,7 +31,7 @@ use Psr\Http\Message\UriInterface;
*/
class ServerRequest implements ServerRequestInterface
{
use MessageTrait, RequestTrait;
use RequestTrait;
/**
* @var array

View File

@ -60,6 +60,10 @@ abstract class ServerRequestFactory
$files = static::normalizeFiles($files ?: $_FILES);
$headers = static::marshalHeaders($server);
if (null === $cookies && array_key_exists('cookie', $headers)) {
$cookies = self::parseCookieHeader($headers['cookie']);
}
return new ServerRequest(
$server,
$files,
@ -485,4 +489,34 @@ abstract class ServerRequestFactory
return $matches['version'];
}
/**
* Parse a cookie header according to RFC 6265.
*
* PHP will replace special characters in cookie names, which results in other cookies not being available due to
* overwriting. Thus, the server request should take the cookies from the request header instead.
*
* @param $cookieHeader
* @return array
*/
private static function parseCookieHeader($cookieHeader)
{
preg_match_all('(
(?:^\\n?[ \t]*|;[ ])
(?P<name>[!#$%&\'*+-.0-9A-Z^_`a-z|~]+)
=
(?P<DQUOTE>"?)
(?P<value>[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*)
(?P=DQUOTE)
(?=\\n?[ \t]*$|;[ ])
)x', $cookieHeader, $matches, PREG_SET_ORDER);
$cookies = [];
foreach ($matches as $match) {
$cookies[$match['name']] = urldecode($match['value']);
}
return $cookies;
}
}

View File

@ -19,7 +19,7 @@ use Psr\Http\Message\StreamInterface;
class Stream implements StreamInterface
{
/**
* @var resource
* @var resource|null
*/
protected $resource;

View File

@ -470,11 +470,11 @@ class Uri implements UriInterface
$uri = '';
if (! empty($scheme)) {
$uri .= sprintf('%s://', $scheme);
$uri .= sprintf('%s:', $scheme);
}
if (! empty($authority)) {
$uri .= $authority;
$uri .= '//' . $authority;
}
if ($path) {