From 6950a654c6206b3b9e1d28d3585df35a3f09506b Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 27 Jun 2016 22:27:06 +0100 Subject: [PATCH] Fix polyfill library (#10947) --- composer.json | 1 + composer.lock | 116 +++++++++++++----- libraries/vendor/composer/autoload_files.php | 1 + libraries/vendor/composer/autoload_psr4.php | 1 + libraries/vendor/composer/installed.json | 58 +++++++++ .../vendor/symfony/polyfill-php55/LICENSE | 19 +++ .../vendor/symfony/polyfill-php55/Php55.php | 63 ++++++++++ .../polyfill-php55/Php55ArrayColumn.php | 64 ++++++++++ .../vendor/symfony/polyfill-php55/README.md | 18 +++ .../symfony/polyfill-php55/bootstrap.php | 27 ++++ .../symfony/polyfill-php55/composer.json | 32 +++++ 11 files changed, 372 insertions(+), 28 deletions(-) create mode 100644 libraries/vendor/symfony/polyfill-php55/LICENSE create mode 100644 libraries/vendor/symfony/polyfill-php55/Php55.php create mode 100644 libraries/vendor/symfony/polyfill-php55/Php55ArrayColumn.php create mode 100644 libraries/vendor/symfony/polyfill-php55/README.md create mode 100644 libraries/vendor/symfony/polyfill-php55/bootstrap.php create mode 100644 libraries/vendor/symfony/polyfill-php55/composer.json diff --git a/composer.json b/composer.json index 9cd4f3b8f4faa..fda3069c9ad66 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,7 @@ "leafo/lessphp": "0.5.0", "paragonie/random_compat": "~1.0", "phpmailer/phpmailer": "5.2.14", + "symfony/polyfill-php55": "~1.2", "symfony/polyfill-php56": "~1.0", "symfony/yaml": "2.*", "simplepie/simplepie": "1.3.1" diff --git a/composer.lock b/composer.lock index 2aeafac6df79a..d32d88a3f9006 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b8580537987ab8119df6ccd016ec6b4d", - "content-hash": "2de13e5ec63c2fbca5143fd4f857600b", + "hash": "98748187cfcae1f7580e2873850ceaea", + "content-hash": "29e123d8f767158b7b37245eed62cfb8", "packages": [ { "name": "ircmaxell/password-compat", @@ -826,6 +826,62 @@ ], "time": "2012-10-30 17:54:03" }, + { + "name": "symfony/polyfill-php55", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "shasum": "" + }, + "require": { + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-05-18 14:26:46" + }, { "name": "symfony/polyfill-php56", "version": "v1.1.1", @@ -1140,32 +1196,32 @@ }, { "name": "phpspec/prophecy", - "version": "v1.6.0", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1", - "sebastian/recursion-context": "~1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -1198,7 +1254,7 @@ "spy", "stub" ], - "time": "2016-02-15 07:46:21" + "time": "2016-06-07 08:13:47" }, { "name": "phpunit/dbunit", @@ -1411,21 +1467,24 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, "type": "library", "autoload": { "classmap": [ @@ -1448,7 +1507,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2016-05-12 18:03:57" }, { "name": "phpunit/php-token-stream", @@ -1745,16 +1804,16 @@ }, { "name": "sebastian/environment", - "version": "1.3.6", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "2292b116f43c272ff4328083096114f84ea46a56" + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/2292b116f43c272ff4328083096114f84ea46a56", - "reference": "2292b116f43c272ff4328083096114f84ea46a56", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", "shasum": "" }, "require": { @@ -1791,20 +1850,20 @@ "environment", "hhvm" ], - "time": "2016-05-04 07:59:13" + "time": "2016-05-17 03:18:57" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { @@ -1812,12 +1871,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1857,7 +1917,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-06-17 09:04:28" }, { "name": "sebastian/global-state", diff --git a/libraries/vendor/composer/autoload_files.php b/libraries/vendor/composer/autoload_files.php index 18aa4b819ac2c..bc30413ae6f83 100644 --- a/libraries/vendor/composer/autoload_files.php +++ b/libraries/vendor/composer/autoload_files.php @@ -24,4 +24,5 @@ 'e40631d46120a9c38ea139981f8dab26' => $vendorDir . '/ircmaxell/password-compat/lib/password.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', + 'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php', ); diff --git a/libraries/vendor/composer/autoload_psr4.php b/libraries/vendor/composer/autoload_psr4.php index 3b0a7506c6d02..7f5212c7afec9 100644 --- a/libraries/vendor/composer/autoload_psr4.php +++ b/libraries/vendor/composer/autoload_psr4.php @@ -8,6 +8,7 @@ return array( 'Symfony\\Polyfill\\Util\\' => array($vendorDir . '/symfony/polyfill-util'), 'Symfony\\Polyfill\\Php56\\' => array($vendorDir . '/symfony/polyfill-php56'), + 'Symfony\\Polyfill\\Php55\\' => array($vendorDir . '/symfony/polyfill-php55'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'Joomla\\Utilities\\Tests\\' => array($vendorDir . '/joomla/utilities/Tests'), 'Joomla\\Utilities\\' => array($vendorDir . '/joomla/utilities/src'), diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index dbabc9feec35c..7166ee1e72896 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -1014,5 +1014,63 @@ "feeds", "rss" ] + }, + { + "name": "symfony/polyfill-php55", + "version": "v1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "shasum": "" + }, + "require": { + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" + }, + "time": "2016-05-18 14:26:46", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ] } ] diff --git a/libraries/vendor/symfony/polyfill-php55/LICENSE b/libraries/vendor/symfony/polyfill-php55/LICENSE new file mode 100644 index 0000000000000..39fa189d2b5fc --- /dev/null +++ b/libraries/vendor/symfony/polyfill-php55/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-2016 Fabien Potencier + +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. diff --git a/libraries/vendor/symfony/polyfill-php55/Php55.php b/libraries/vendor/symfony/polyfill-php55/Php55.php new file mode 100644 index 0000000000000..396baf26de871 --- /dev/null +++ b/libraries/vendor/symfony/polyfill-php55/Php55.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php55; + +/** + * @internal + */ +final class Php55 +{ + public static function boolval($val) + { + return (bool) $val; + } + + public static function json_last_error_msg() + { + switch (json_last_error()) { + case JSON_ERROR_NONE: return 'No error'; + case JSON_ERROR_DEPTH: return 'Maximum stack depth exceeded'; + case JSON_ERROR_STATE_MISMATCH: return 'State mismatch (invalid or malformed JSON)'; + case JSON_ERROR_CTRL_CHAR: return 'Control character error, possibly incorrectly encoded'; + case JSON_ERROR_SYNTAX: return 'Syntax error'; + case JSON_ERROR_UTF8: return 'Malformed UTF-8 characters, possibly incorrectly encoded'; + default: return 'Unknown error'; + } + } + + /** + * @author Sebastiaan Stok + */ + public static function hash_pbkdf2($algorithm, $password, $salt, $iterations, $length = 0, $rawOutput = false) + { + // Number of blocks needed to create the derived key + $blocks = ceil($length / strlen(hash($algorithm, null, true))); + $digest = ''; + + for ($i = 1; $i <= $blocks; ++$i) { + $ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true); + + // Iterations + for ($j = 1; $j < $iterations; ++$j) { + $ib ^= ($block = hash_hmac($algorithm, $block, $password, true)); + } + + $digest .= $ib; + } + + if (!$rawOutput) { + $digest = bin2hex($digest); + } + + return substr($digest, 0, $length); + } +} diff --git a/libraries/vendor/symfony/polyfill-php55/Php55ArrayColumn.php b/libraries/vendor/symfony/polyfill-php55/Php55ArrayColumn.php new file mode 100644 index 0000000000000..a3033d83ed3af --- /dev/null +++ b/libraries/vendor/symfony/polyfill-php55/Php55ArrayColumn.php @@ -0,0 +1,64 @@ + + * + * 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. + */ + +namespace Symfony\Polyfill\Php55; + +/** + * @internal + */ +final class Php55ArrayColumn +{ + public static function array_column(array $input, $columnKey, $indexKey = null) + { + $output = array(); + + foreach ($input as $row) { + $key = $value = null; + $keySet = $valueSet = false; + + if ($indexKey !== null && array_key_exists($indexKey, $row)) { + $keySet = true; + $key = (string) $row[$indexKey]; + } + + if ($columnKey === null) { + $valueSet = true; + $value = $row; + } elseif (is_array($row) && array_key_exists($columnKey, $row)) { + $valueSet = true; + $value = $row[$columnKey]; + } + + if ($valueSet) { + if ($keySet) { + $output[$key] = $value; + } else { + $output[] = $value; + } + } + } + + return $output; + } +} diff --git a/libraries/vendor/symfony/polyfill-php55/README.md b/libraries/vendor/symfony/polyfill-php55/README.md new file mode 100644 index 0000000000000..3e432e4935ce6 --- /dev/null +++ b/libraries/vendor/symfony/polyfill-php55/README.md @@ -0,0 +1,18 @@ +Symfony Polyfill / Php55 +======================== + +This component provides functions unavailable in releases prior to PHP 5.5: + +- [`boolval`](http://php.net/boolval) +- [`json_last_error_msg`](http://php.net/json_last_error_msg) +- [`array_column`](http://php.net/array_column) +- [`hash_pbkdf2`](http://php.net/hash_pbkdf2) +- `password_*` functions (from [ircmaxell/password_compat](https://github.com/ircmaxell/password_compat)) + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/libraries/vendor/symfony/polyfill-php55/bootstrap.php b/libraries/vendor/symfony/polyfill-php55/bootstrap.php new file mode 100644 index 0000000000000..5e634feb04a1a --- /dev/null +++ b/libraries/vendor/symfony/polyfill-php55/bootstrap.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Php55 as p; + +if (PHP_VERSION_ID < 50500) { + if (!function_exists('boolval')) { + function boolval($val) { return p\Php55::boolval($val); } + } + if (!function_exists('json_last_error_msg')) { + function json_last_error_msg() { return p\Php55::json_last_error_msg(); } + } + if (!function_exists('array_column')) { + function array_column($array, $columnKey, $indexKey = null) { return p\Php55ArrayColumn::array_column($array, $columnKey, $indexKey); } + } + if (!function_exists('hash_pbkdf2')) { + function hash_pbkdf2($algorithm, $password, $salt, $iterations, $length = 0, $rawOutput = false) { return p\Php55::hash_pbkdf2($algorithm, $password, $salt, $iterations, $length, $rawOutput); } + } +} diff --git a/libraries/vendor/symfony/polyfill-php55/composer.json b/libraries/vendor/symfony/polyfill-php55/composer.json new file mode 100644 index 0000000000000..6a9e72000f05f --- /dev/null +++ b/libraries/vendor/symfony/polyfill-php55/composer.json @@ -0,0 +1,32 @@ +{ + "name": "symfony/polyfill-php55", + "type": "library", + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "keywords": ["polyfill", "shim", "compatibility", "portable"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3", + "ircmaxell/password-compat": "~1.0" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Php55\\": "" }, + "files": [ "bootstrap.php" ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + } +}