Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/307625
Change subject: Update libs
......................................................................
Update libs
Change-Id: Iede6fe959fdf4381243ce78acb66545a5776b2a1
---
M coderkungfu/php-queue/src/PHPQueue/Backend/PDO.php
M composer/installed.json
M monolog/monolog/CHANGELOG.mdown
M monolog/monolog/src/Monolog/ErrorHandler.php
M monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
M monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
M monolog/monolog/src/Monolog/Handler/SlackHandler.php
M monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
M monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
M monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
M symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
M symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
M symfony/http-foundation/Request.php
M symfony/http-foundation/Response.php
M symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
M symfony/http-foundation/Tests/RequestTest.php
M
symfony/http-foundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
M
symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
M symfony/yaml/Tests/ParserTest.php
M symfony/yaml/Yaml.php
20 files changed, 560 insertions(+), 322 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig/vendor
refs/changes/25/307625/1
diff --git a/coderkungfu/php-queue/src/PHPQueue/Backend/PDO.php
b/coderkungfu/php-queue/src/PHPQueue/Backend/PDO.php
index 5b1fd28..9d0adbe 100644
--- a/coderkungfu/php-queue/src/PHPQueue/Backend/PDO.php
+++ b/coderkungfu/php-queue/src/PHPQueue/Backend/PDO.php
@@ -104,8 +104,8 @@
throw new \Exception('Could not prepare statement');
}
$_tmp = json_encode($data);
- $sth->bindParam(1, $_tmp, \PDO::PARAM_STR);
- $sth->bindParam(2, self::getTimeStamp(), \PDO::PARAM_STR);
+ $sth->bindValue(1, $_tmp, \PDO::PARAM_STR);
+ $sth->bindValue(2, self::getTimeStamp(), \PDO::PARAM_STR);
return $sth->execute();
}
@@ -114,9 +114,9 @@
$sql = sprintf('REPLACE INTO `%s` (`id`, `data`, `timestamp`) VALUES
(?, ?, ?)', $this->db_table);
$sth = $this->getConnection()->prepare($sql);
$_tmp = json_encode($data);
- $sth->bindParam(1, $id, \PDO::PARAM_INT);
- $sth->bindParam(2, $_tmp, \PDO::PARAM_STR);
- $sth->bindParam(3, self::getTimeStamp(), \PDO::PARAM_STR);
+ $sth->bindValue(1, $id, \PDO::PARAM_INT);
+ $sth->bindValue(2, $_tmp, \PDO::PARAM_STR);
+ $sth->bindValue(3, self::getTimeStamp(), \PDO::PARAM_STR);
$sth->execute();
}
@@ -137,7 +137,7 @@
$sql = sprintf('SELECT `id`, `data` FROM `%s` WHERE `id` = ?',
$this->db_table);
$sth = $this->getConnection()->prepare($sql);
- $sth->bindParam(1, $id, \PDO::PARAM_INT);
+ $sth->bindValue(1, $id, \PDO::PARAM_INT);
$sth->execute();
$result = $sth->fetch(\PDO::FETCH_ASSOC);
@@ -193,7 +193,7 @@
try {
$sql = sprintf('DELETE FROM `%s` WHERE `id` = ?', $this->db_table);
$sth = $this->getConnection()->prepare($sql);
- $sth->bindParam(1, $id, \PDO::PARAM_INT);
+ $sth->bindValue(1, $id, \PDO::PARAM_INT);
$sth->execute();
} catch (\Exception $ex) {
throw new BackendException('Invalid ID.');
diff --git a/composer/installed.json b/composer/installed.json
index 500a3ec..937df73 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -237,86 +237,6 @@
]
},
{
- "name": "monolog/monolog",
- "version": "1.20.0",
- "version_normalized": "1.20.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/Seldaek/monolog.git",
- "reference": "55841909e2bcde01b5318c35f2b74f8ecc86e037"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/Seldaek/monolog/zipball/55841909e2bcde01b5318c35f2b74f8ecc86e037",
- "reference": "55841909e2bcde01b5318c35f2b74f8ecc86e037",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0",
- "psr/log": "~1.0"
- },
- "provide": {
- "psr/log-implementation": "1.0.0"
- },
- "require-dev": {
- "aws/aws-sdk-php": "^2.4.9",
- "doctrine/couchdb": "~1.0@dev",
- "graylog2/gelf-php": "~1.0",
- "jakub-onderka/php-parallel-lint": "0.9",
- "php-amqplib/php-amqplib": "~2.4",
- "php-console/php-console": "^3.1.3",
- "phpunit/phpunit": "~4.5",
- "phpunit/phpunit-mock-objects": "2.3.0",
- "ruflin/elastica": ">=0.90 <3.0",
- "sentry/sentry": "^0.13",
- "swiftmailer/swiftmailer": "~5.3"
- },
- "suggest": {
- "aws/aws-sdk-php": "Allow sending log messages to AWS services
like DynamoDB",
- "doctrine/couchdb": "Allow sending log messages to a CouchDB
server",
- "ext-amqp": "Allow sending log messages to an AMQP server (1.0+
required)",
- "ext-mongo": "Allow sending log messages to a MongoDB server",
- "graylog2/gelf-php": "Allow sending log messages to a GrayLog2
server",
- "mongodb/mongodb": "Allow sending log messages to a MongoDB server
via PHP Driver",
- "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP
server using php-amqplib",
- "php-console/php-console": "Allow sending log messages to Google
Chrome",
- "rollbar/rollbar": "Allow sending log messages to Rollbar",
- "ruflin/elastica": "Allow sending log messages to an Elastic
Search server",
- "sentry/sentry": "Allow sending log messages to a Sentry server"
- },
- "time": "2016-07-02 14:02:10",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.0.x-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "Monolog\\": "src/Monolog"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jordi Boggiano",
- "email": "[email protected]",
- "homepage": "http://seld.be"
- }
- ],
- "description": "Sends your logs to files, sockets, inboxes, databases
and various web services",
- "homepage": "http://github.com/Seldaek/monolog",
- "keywords": [
- "log",
- "logging",
- "psr-3"
- ]
- },
- {
"name": "phpmailer/phpmailer",
"version": "v5.2.16",
"version_normalized": "5.2.16.0",
@@ -377,68 +297,6 @@
}
],
"description": "PHPMailer is a full-featured email creation and
transfer class for PHP"
- },
- {
- "name": "symfony/event-dispatcher",
- "version": "v2.8.8",
- "version_normalized": "2.8.8.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "b180b70439dca70049b6b9b7e21d75e6e5d7aca9"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/symfony/event-dispatcher/zipball/b180b70439dca70049b6b9b7e21d75e6e5d7aca9",
- "reference": "b180b70439dca70049b6b9b7e21d75e6e5d7aca9",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "require-dev": {
- "psr/log": "~1.0",
- "symfony/config": "~2.0,>=2.0.5|~3.0.0",
- "symfony/dependency-injection": "~2.6|~3.0.0",
- "symfony/expression-language": "~2.6|~3.0.0",
- "symfony/stopwatch": "~2.3|~3.0.0"
- },
- "suggest": {
- "symfony/dependency-injection": "",
- "symfony/http-kernel": ""
- },
- "time": "2016-06-29 05:29:29",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\EventDispatcher\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "[email protected]"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony EventDispatcher Component",
- "homepage": "https://symfony.com"
},
{
"name": "ircmaxell/password-compat",
@@ -603,114 +461,6 @@
]
},
{
- "name": "symfony/http-foundation",
- "version": "v2.8.8",
- "version_normalized": "2.8.8.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/http-foundation.git",
- "reference": "7a55440a2bebd37b8bd06f99f5def1ddf0aa9249"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/symfony/http-foundation/zipball/7a55440a2bebd37b8bd06f99f5def1ddf0aa9249",
- "reference": "7a55440a2bebd37b8bd06f99f5def1ddf0aa9249",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9",
- "symfony/polyfill-mbstring": "~1.1",
- "symfony/polyfill-php54": "~1.0",
- "symfony/polyfill-php55": "~1.0"
- },
- "require-dev": {
- "symfony/expression-language": "~2.4|~3.0.0"
- },
- "time": "2016-06-29 07:02:14",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\HttpFoundation\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "[email protected]"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony HttpFoundation Component",
- "homepage": "https://symfony.com"
- },
- {
- "name": "symfony/yaml",
- "version": "v2.8.8",
- "version_normalized": "2.8.8.0",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/yaml.git",
- "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/symfony/yaml/zipball/dba4bb5846798cd12f32e2d8f3f35d77045773c8",
- "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.9"
- },
- "time": "2016-06-29 05:29:29",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.8-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Yaml\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "[email protected]"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Yaml Component",
- "homepage": "https://symfony.com"
- },
- {
"name": "predis/predis",
"version": "v1.1.1",
"version_normalized": "1.1.1.0",
@@ -769,7 +519,7 @@
"source": {
"type": "git",
"url":
"https://gerrit.wikimedia.org/r/p/wikimedia/fundraising/php-queue.git",
- "reference": "72dd99b732e387e40ac24c3ec870503bc93f14ad"
+ "reference": "14198ba1f7d4868933649a85621a3955965e83cd"
},
"require": {
"clio/clio": "0.1.*",
@@ -793,7 +543,7 @@
"pecl-mongodb": "For MongoDB backend support",
"predis/predis": "For Redis backend support"
},
- "time": "2016-08-04 21:28:00",
+ "time": "2016-08-05 19:16:32",
"type": "library",
"extra": {
"branch-alias": {
@@ -827,5 +577,255 @@
"queue",
"transaction"
]
+ },
+ {
+ "name": "monolog/monolog",
+ "version": "1.21.0",
+ "version_normalized": "1.21.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/monolog.git",
+ "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952",
+ "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "psr/log": "~1.0"
+ },
+ "provide": {
+ "psr/log-implementation": "1.0.0"
+ },
+ "require-dev": {
+ "aws/aws-sdk-php": "^2.4.9",
+ "doctrine/couchdb": "~1.0@dev",
+ "graylog2/gelf-php": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.9",
+ "php-amqplib/php-amqplib": "~2.4",
+ "php-console/php-console": "^3.1.3",
+ "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit-mock-objects": "2.3.0",
+ "ruflin/elastica": ">=0.90 <3.0",
+ "sentry/sentry": "^0.13",
+ "swiftmailer/swiftmailer": "~5.3"
+ },
+ "suggest": {
+ "aws/aws-sdk-php": "Allow sending log messages to AWS services
like DynamoDB",
+ "doctrine/couchdb": "Allow sending log messages to a CouchDB
server",
+ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+
required)",
+ "ext-mongo": "Allow sending log messages to a MongoDB server",
+ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2
server",
+ "mongodb/mongodb": "Allow sending log messages to a MongoDB server
via PHP Driver",
+ "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP
server using php-amqplib",
+ "php-console/php-console": "Allow sending log messages to Google
Chrome",
+ "rollbar/rollbar": "Allow sending log messages to Rollbar",
+ "ruflin/elastica": "Allow sending log messages to an Elastic
Search server",
+ "sentry/sentry": "Allow sending log messages to a Sentry server"
+ },
+ "time": "2016-07-29 03:23:52",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Monolog\\": "src/Monolog"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "[email protected]",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "Sends your logs to files, sockets, inboxes, databases
and various web services",
+ "homepage": "http://github.com/Seldaek/monolog",
+ "keywords": [
+ "log",
+ "logging",
+ "psr-3"
+ ]
+ },
+ {
+ "name": "symfony/event-dispatcher",
+ "version": "v2.8.9",
+ "version_normalized": "2.8.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/event-dispatcher.git",
+ "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/symfony/event-dispatcher/zipball/889983a79a043dfda68f38c38b6dba092dd49cd8",
+ "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.0,>=2.0.5|~3.0.0",
+ "symfony/dependency-injection": "~2.6|~3.0.0",
+ "symfony/expression-language": "~2.6|~3.0.0",
+ "symfony/stopwatch": "~2.3|~3.0.0"
+ },
+ "suggest": {
+ "symfony/dependency-injection": "",
+ "symfony/http-kernel": ""
+ },
+ "time": "2016-07-28 16:56:28",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.8-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\EventDispatcher\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony EventDispatcher Component",
+ "homepage": "https://symfony.com"
+ },
+ {
+ "name": "symfony/http-foundation",
+ "version": "v2.8.9",
+ "version_normalized": "2.8.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/http-foundation.git",
+ "reference": "f20bea598906c990eebe3c70a63ca5ed18cdbc11"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/symfony/http-foundation/zipball/f20bea598906c990eebe3c70a63ca5ed18cdbc11",
+ "reference": "f20bea598906c990eebe3c70a63ca5ed18cdbc11",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9",
+ "symfony/polyfill-mbstring": "~1.1",
+ "symfony/polyfill-php54": "~1.0",
+ "symfony/polyfill-php55": "~1.0"
+ },
+ "require-dev": {
+ "symfony/expression-language": "~2.4|~3.0.0"
+ },
+ "time": "2016-07-30 07:20:35",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.8-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\HttpFoundation\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony HttpFoundation Component",
+ "homepage": "https://symfony.com"
+ },
+ {
+ "name": "symfony/yaml",
+ "version": "v2.8.9",
+ "version_normalized": "2.8.9.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "0ceab136f43ed9d3e97b3eea32a7855dc50c121d"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/symfony/yaml/zipball/0ceab136f43ed9d3e97b3eea32a7855dc50c121d",
+ "reference": "0ceab136f43ed9d3e97b3eea32a7855dc50c121d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "time": "2016-07-17 09:06:15",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.8-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com"
}
]
diff --git a/monolog/monolog/CHANGELOG.mdown b/monolog/monolog/CHANGELOG.mdown
index 7624cac..5f81e24 100644
--- a/monolog/monolog/CHANGELOG.mdown
+++ b/monolog/monolog/CHANGELOG.mdown
@@ -1,3 +1,11 @@
+### 1.21.0 (2016-07-29)
+
+ * Break: Reverted the addition of $context when the ErrorHandler handles
regular php errors from 1.20.0 as it was causing issues
+ * Added support for more formats in RotatingFileHandler::setFilenameFormat
as long as they have Y, m and d in order
+ * Added ability to format the main line of text the SlackHandler sends by
explictly setting a formatter on the handler
+ * Added information about SoapFault instances in NormalizerFormatter
+ * Added $handleOnlyReportedErrors option on
ErrorHandler::registerErrorHandler (default true) to allow logging of all
errors no matter the error_reporting level
+
### 1.20.0 (2016-07-02)
* Added FingersCrossedHandler::activate() to manually trigger the handler
regardless of the activation policy
diff --git a/monolog/monolog/src/Monolog/ErrorHandler.php
b/monolog/monolog/src/Monolog/ErrorHandler.php
index 715b93a..0152298 100644
--- a/monolog/monolog/src/Monolog/ErrorHandler.php
+++ b/monolog/monolog/src/Monolog/ErrorHandler.php
@@ -33,6 +33,7 @@
private $previousErrorHandler;
private $errorLevelMap;
+ private $handleOnlyReportedErrors;
private $hasFatalErrorHandler;
private $fatalLevel;
@@ -80,13 +81,15 @@
}
}
- public function registerErrorHandler(array $levelMap = array(),
$callPrevious = true, $errorTypes = -1)
+ public function registerErrorHandler(array $levelMap = array(),
$callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true)
{
$prev = set_error_handler(array($this, 'handleError'), $errorTypes);
$this->errorLevelMap = array_replace($this->defaultErrorLevelMap(),
$levelMap);
if ($callPrevious) {
$this->previousErrorHandler = $prev ?: true;
}
+
+ $this->handleOnlyReportedErrors = $handleOnlyReportedErrors;
}
public function registerFatalHandler($level = null, $reservedMemorySize =
20)
@@ -142,14 +145,14 @@
*/
public function handleError($code, $message, $file = '', $line = 0,
$context = array())
{
- if (!(error_reporting() & $code)) {
+ if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) {
return;
}
// fatal error codes are ignored if a fatal error handler is present
as well to avoid duplicate log entries
if (!$this->hasFatalErrorHandler || !in_array($code,
self::$fatalErrors, true)) {
$level = isset($this->errorLevelMap[$code]) ?
$this->errorLevelMap[$code] : LogLevel::CRITICAL;
- $this->logger->log($level, self::codeToString($code).':
'.$message, array('code' => $code, 'message' => $message, 'file' => $file,
'line' => $line, 'context' => $context));
+ $this->logger->log($level, self::codeToString($code).':
'.$message, array('code' => $code, 'message' => $message, 'file' => $file,
'line' => $line));
}
if ($this->previousErrorHandler === true) {
diff --git a/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
b/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
index 9a4d5d2..ab79dbc 100644
--- a/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
+++ b/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
@@ -127,6 +127,20 @@
'file' => $e->getFile().':'.$e->getLine(),
);
+ if ($e instanceof \SoapFault) {
+ if (isset($e->faultcode)) {
+ $data['faultcode'] = $e->faultcode;
+ }
+
+ if (isset($e->faultactor)) {
+ $data['faultactor'] = $e->faultactor;
+ }
+
+ if (isset($e->detail)) {
+ $data['detail'] = $e->detail;
+ }
+ }
+
$trace = $e->getTrace();
foreach ($trace as $frame) {
if (isset($frame['file'])) {
diff --git a/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
b/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
index cd93805..3b60b3d 100644
--- a/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
+++ b/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
@@ -68,11 +68,12 @@
public function setFilenameFormat($filenameFormat, $dateFormat)
{
- if (!in_array($dateFormat, array(self::FILE_PER_DAY,
self::FILE_PER_MONTH, self::FILE_PER_YEAR))) {
+ if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) {
trigger_error(
- 'Invalid date format - format should be one of '.
- 'RotatingFileHandler::FILE_PER_DAY,
RotatingFileHandler::FILE_PER_MONTH '.
- 'or RotatingFileHandler::FILE_PER_YEAR.',
+ 'Invalid date format - format must be one of '.
+ 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"),
RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.
+ 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set
one of the '.
+ 'date formats using slashes, underscores and/or dots instead
of dashes.',
E_USER_DEPRECATED
);
}
diff --git a/monolog/monolog/src/Monolog/Handler/SlackHandler.php
b/monolog/monolog/src/Monolog/Handler/SlackHandler.php
index ac2af02..3de2576 100644
--- a/monolog/monolog/src/Monolog/Handler/SlackHandler.php
+++ b/monolog/monolog/src/Monolog/Handler/SlackHandler.php
@@ -144,19 +144,25 @@
'attachments' => array(),
);
+ if ($this->formatter) {
+ $message = $this->formatter->format($record);
+ } else {
+ $message = $record['message'];
+ }
+
if ($this->useAttachment) {
$attachment = array(
- 'fallback' => $record['message'],
+ 'fallback' => $message,
'color' => $this->getAttachmentColor($record['level']),
'fields' => array(),
);
if ($this->useShortAttachment) {
$attachment['title'] = $record['level_name'];
- $attachment['text'] = $record['message'];
+ $attachment['text'] = $message;
} else {
$attachment['title'] = 'Message';
- $attachment['text'] = $record['message'];
+ $attachment['text'] = $message;
$attachment['fields'][] = array(
'title' => 'Level',
'value' => $record['level_name'],
@@ -206,7 +212,7 @@
$dataArray['attachments'] = json_encode(array($attachment));
} else {
- $dataArray['text'] = $record['message'];
+ $dataArray['text'] = $message;
}
if ($this->iconEmoji) {
diff --git
a/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
b/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
index 83adb7e..ea752b4 100644
--- a/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
+++ b/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
@@ -85,6 +85,33 @@
), $formatted);
}
+ public function testFormatSoapFaultException()
+ {
+ if (!class_exists('SoapFault')) {
+ $this->markTestSkipped('Requires the soap extension');
+ }
+
+ $formatter = new NormalizerFormatter('Y-m-d');
+ $e = new \SoapFault('foo', 'bar', 'hello', 'world');
+ $formatted = $formatter->format(array(
+ 'exception' => $e,
+ ));
+
+ unset($formatted['exception']['trace']);
+
+ $this->assertEquals(array(
+ 'exception' => array(
+ 'class' => 'SoapFault',
+ 'message' => 'bar',
+ 'code' => 0,
+ 'file' => $e->getFile().':'.$e->getLine(),
+ 'faultcode' => 'foo',
+ 'faultactor' => 'hello',
+ 'detail' => 'world',
+ ),
+ ), $formatted);
+ }
+
public function testFormatToStringExceptionHandle()
{
$formatter = new NormalizerFormatter('Y-m-d');
diff --git a/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
b/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
index 96e6dff..c510617 100644
--- a/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
+++ b/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
@@ -145,9 +145,9 @@
if (!$valid) {
$this->assertErrorWasTriggered(
E_USER_DEPRECATED,
- 'Invalid date format - format should be one of '.
- 'RotatingFileHandler::FILE_PER_DAY,
RotatingFileHandler::FILE_PER_MONTH '.
- 'or RotatingFileHandler::FILE_PER_YEAR.'
+ 'Invalid date format - format must be one of
RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), '.
+ 'RotatingFileHandler::FILE_PER_MONTH ("Y-m") or
RotatingFileHandler::FILE_PER_YEAR ("Y"), '.
+ 'or you can set one of the date formats using slashes,
underscores and/or dots instead of dashes.'
);
}
}
diff --git a/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
b/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
index d657fae..a1fd872 100644
--- a/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
+++ b/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
@@ -13,6 +13,7 @@
use Monolog\TestCase;
use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
/**
* @author Greg Kedzierski <[email protected]>
@@ -57,6 +58,23 @@
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=&attachments=.*$/',
$content);
}
+ public function testWriteContentUsesFormatterIfProvided()
+ {
+ $this->createHandler('myToken', 'channel1', 'Monolog', false);
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->createHandler('myToken', 'channel1', 'Monolog', false);
+ $this->handler->setFormatter(new LineFormatter('foo--%message%'));
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test2'));
+ fseek($this->res, 0);
+ $content2 = fread($this->res, 1024);
+
+
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=test1.*$/',
$content);
+
$this->assertRegexp('/token=myToken&channel=channel1&username=Monolog&text=foo--test2.*$/',
$content2);
+ }
+
public function testWriteContentWithEmoji()
{
$this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien');
diff --git
a/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
b/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
index ebfe435..326bfd1 100644
--- a/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
+++ b/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
@@ -97,9 +97,13 @@
// We must assume that the class value has been correctly filled,
even if the service is created by a factory
$class =
$container->getParameterBag()->resolveValue($def->getClass());
-
$interface =
'Symfony\Component\EventDispatcher\EventSubscriberInterface';
+
if (!is_subclass_of($class, $interface)) {
+ if (!class_exists($class, false)) {
+ throw new \InvalidArgumentException(sprintf('Class "%s"
used for service "%s" cannot be found.', $class, $id));
+ }
+
throw new \InvalidArgumentException(sprintf('Service "%s" must
implement interface "%s".', $id, $interface));
}
diff --git a/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
b/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
index 0169ede..5e16532 100644
--- a/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
+++ b/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
@@ -142,7 +142,7 @@
public function testLegacyDispatch()
{
$event = new Event();
- $return = $this->dispatcher->dispatch(self::preFoo, $event);
+ $this->dispatcher->dispatch(self::preFoo, $event);
$this->assertEquals('pre.foo', $event->getName());
}
diff --git a/symfony/http-foundation/Request.php
b/symfony/http-foundation/Request.php
index 16a9375..3d53f64 100644
--- a/symfony/http-foundation/Request.php
+++ b/symfony/http-foundation/Request.php
@@ -1476,7 +1476,7 @@
*/
public function isMethodSafe()
{
- return in_array($this->getMethod(), array('GET', 'HEAD'));
+ return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS',
'TRACE'));
}
/**
diff --git a/symfony/http-foundation/Response.php
b/symfony/http-foundation/Response.php
index bc3ab23..009ce65 100644
--- a/symfony/http-foundation/Response.php
+++ b/symfony/http-foundation/Response.php
@@ -373,6 +373,12 @@
$this->sendHeaders();
$this->sendContent();
+ if (function_exists('fastcgi_finish_request')) {
+ fastcgi_finish_request();
+ } elseif ('cli' !== PHP_SAPI) {
+ static::closeOutputBuffers(0, true);
+ }
+
return $this;
}
diff --git
a/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
b/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
index f1df25d..7efc134 100644
--- a/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
+++ b/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
@@ -19,7 +19,7 @@
class MongoDbSessionHandler implements \SessionHandlerInterface
{
/**
- * @var \Mongo
+ * @var \Mongo|\MongoClient|\MongoDB\Client
*/
private $mongo;
@@ -61,15 +61,15 @@
* If you use such an index, you can drop `gc_probability` to 0 since
* no garbage-collection is required.
*
- * @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance
- * @param array $options An associative array of field
options
+ * @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client,
MongoClient or Mongo instance
+ * @param array $options An associative
array of field options
*
* @throws \InvalidArgumentException When MongoClient or Mongo instance
not provided
* @throws \InvalidArgumentException When "database" or "collection" not
provided
*/
public function __construct($mongo, array $options)
{
- if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
+ if (!($mongo instanceof \MongoDB\Client || $mongo instanceof
\MongoClient || $mongo instanceof \Mongo)) {
throw new \InvalidArgumentException('MongoClient or Mongo instance
required');
}
@@ -108,7 +108,9 @@
*/
public function destroy($sessionId)
{
- $this->getCollection()->remove(array(
+ $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' :
'remove';
+
+ $this->getCollection()->$methodName(array(
$this->options['id_field'] => $sessionId,
));
@@ -120,8 +122,10 @@
*/
public function gc($maxlifetime)
{
- $this->getCollection()->remove(array(
- $this->options['expiry_field'] => array('$lt' => new \MongoDate()),
+ $methodName = $this->mongo instanceof \MongoDB\Client ? 'deleteOne' :
'remove';
+
+ $this->getCollection()->$methodName(array(
+ $this->options['expiry_field'] => array('$lt' =>
$this->createDateTime()),
));
return true;
@@ -132,18 +136,28 @@
*/
public function write($sessionId, $data)
{
- $expiry = new \MongoDate(time() + (int)
ini_get('session.gc_maxlifetime'));
+ $expiry = $this->createDateTime(time() + (int)
ini_get('session.gc_maxlifetime'));
$fields = array(
- $this->options['data_field'] => new \MongoBinData($data,
\MongoBinData::BYTE_ARRAY),
- $this->options['time_field'] => new \MongoDate(),
+ $this->options['time_field'] => $this->createDateTime(),
$this->options['expiry_field'] => $expiry,
);
- $this->getCollection()->update(
+ $options = array('upsert' => true);
+
+ if ($this->mongo instanceof \MongoDB\Client) {
+ $fields[$this->options['data_field']] = new
\MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY);
+ } else {
+ $fields[$this->options['data_field']] = new \MongoBinData($data,
\MongoBinData::BYTE_ARRAY);
+ $options['multiple'] = false;
+ }
+
+ $methodName = $this->mongo instanceof \MongoDB\Client ? 'updateOne' :
'update';
+
+ $this->getCollection()->$methodName(
array($this->options['id_field'] => $sessionId),
array('$set' => $fields),
- array('upsert' => true, 'multiple' => false)
+ $options
);
return true;
@@ -156,10 +170,18 @@
{
$dbData = $this->getCollection()->findOne(array(
$this->options['id_field'] => $sessionId,
- $this->options['expiry_field'] => array('$gte' => new
\MongoDate()),
+ $this->options['expiry_field'] => array('$gte' =>
$this->createDateTime()),
));
- return null === $dbData ? '' :
$dbData[$this->options['data_field']]->bin;
+ if (null === $dbData) {
+ return '';
+ }
+
+ if ($dbData[$this->options['data_field']] instanceof
\MongoDB\BSON\Binary) {
+ return $dbData[$this->options['data_field']]->getData();
+ }
+
+ return $dbData[$this->options['data_field']]->bin;
}
/**
@@ -179,10 +201,30 @@
/**
* Return a Mongo instance.
*
- * @return \Mongo
+ * @return \Mongo|\MongoClient|\MongoDB\Client
*/
protected function getMongo()
{
return $this->mongo;
}
+
+ /**
+ * Create a date object using the class appropriate for the current mongo
connection.
+ *
+ * Return an instance of a MongoDate or \MongoDB\BSON\UTCDateTime
+ *
+ * @param int $seconds An integer representing UTC seconds since Jan 1
1970. Defaults to now.
+ */
+ private function createDateTime($seconds = null)
+ {
+ if (null === $seconds) {
+ $seconds = time();
+ }
+
+ if ($this->mongo instanceof \MongoDB\Client) {
+ return new \MongoDB\BSON\UTCDateTime($seconds * 1000);
+ }
+
+ return new \MongoDate($seconds);
+ }
}
diff --git a/symfony/http-foundation/Tests/RequestTest.php
b/symfony/http-foundation/Tests/RequestTest.php
index 1edc48c..8540cad 100644
--- a/symfony/http-foundation/Tests/RequestTest.php
+++ b/symfony/http-foundation/Tests/RequestTest.php
@@ -1912,6 +1912,32 @@
array(str_repeat(':', 101)),
);
}
+
+ /**
+ * @dataProvider methodSafeProvider
+ */
+ public function testMethodSafe($method, $safe)
+ {
+ $request = new Request();
+ $request->setMethod($method);
+ $this->assertEquals($safe, $request->isMethodSafe());
+ }
+
+ public function methodSafeProvider()
+ {
+ return array(
+ array('HEAD', true),
+ array('GET', true),
+ array('POST', false),
+ array('PUT', false),
+ array('PATCH', false),
+ array('DELETE', false),
+ array('PURGE', false),
+ array('OPTIONS', true),
+ array('TRACE', true),
+ array('CONNECT', false),
+ );
+ }
}
class RequestContentProxy extends Request
diff --git
a/symfony/http-foundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
b/symfony/http-foundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
index 4efb33c..f8497f5 100644
---
a/symfony/http-foundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
+++
b/symfony/http-foundation/Tests/Session/Storage/Handler/LegacyPdoSessionHandlerTest.php
@@ -58,7 +58,7 @@
{
$storage = new LegacyPdoSessionHandler($this->pdo, array('db_table' =>
'bad_name'));
$this->setExpectedException('RuntimeException');
- $storage->read('foo', 'bar');
+ $storage->read('foo');
}
public function testWriteRead()
diff --git
a/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
b/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
index 556f26a..0ae0d4b 100644
---
a/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++
b/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -15,7 +15,6 @@
/**
* @author Markus Bachmann <[email protected]>
- * @requires extension mongo
* @group time-sensitive
*/
class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase
@@ -31,7 +30,15 @@
{
parent::setUp();
- $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ?
'Mongo' : 'MongoClient';
+ if (!extension_loaded('mongo') && !extension_loaded('mongodb')) {
+ $this->markTestSkipped('The Mongo or MongoDB extension is
required.');
+ }
+
+ if (phpversion('mongodb')) {
+ $mongoClass = 'MongoDB\Client';
+ } else {
+ $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ?
'Mongo' : 'MongoClient';
+ }
$this->mongo = $this->getMockBuilder($mongoClass)
->disableOriginalConstructor()
@@ -98,14 +105,28 @@
$that->assertArrayHasKey($that->options['expiry_field'],
$criteria);
$that->assertArrayHasKey('$gte',
$criteria[$that->options['expiry_field']]);
- $that->assertInstanceOf('MongoDate',
$criteria[$that->options['expiry_field']]['$gte']);
-
$that->assertGreaterThanOrEqual($criteria[$that->options['expiry_field']]['$gte']->sec,
$testTimeout);
- return array(
+ if (phpversion('mongodb')) {
+ $that->assertInstanceOf('MongoDB\BSON\UTCDateTime',
$criteria[$that->options['expiry_field']]['$gte']);
+ $that->assertGreaterThanOrEqual(round(intval((string)
$criteria[$that->options['expiry_field']]['$gte']) / 1000), $testTimeout);
+ } else {
+ $that->assertInstanceOf('MongoDate',
$criteria[$that->options['expiry_field']]['$gte']);
+
$that->assertGreaterThanOrEqual($criteria[$that->options['expiry_field']]['$gte']->sec,
$testTimeout);
+ }
+
+ $fields = array(
$that->options['id_field'] => 'foo',
- $that->options['data_field'] => new \MongoBinData('bar',
\MongoBinData::BYTE_ARRAY),
- $that->options['id_field'] => new \MongoDate(),
);
+
+ if (phpversion('mongodb')) {
+ $fields[$that->options['data_field']] = new
\MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY);
+ $fields[$that->options['id_field']] = new
\MongoDB\BSON\UTCDateTime(time() * 1000);
+ } else {
+ $fields[$that->options['data_field']] = new
\MongoBinData('bar', \MongoBinData::BYTE_ARRAY);
+ $fields[$that->options['id_field']] = new \MongoDate();
+ }
+
+ return $fields;
}));
$this->assertEquals('bar', $this->storage->read('foo'));
@@ -123,11 +144,18 @@
$that = $this;
$data = array();
+ $methodName = phpversion('mongodb') ? 'updateOne' : 'update';
+
$collection->expects($this->once())
- ->method('update')
+ ->method($methodName)
->will($this->returnCallback(function ($criteria, $updateData,
$options) use ($that, &$data) {
$that->assertEquals(array($that->options['id_field'] =>
'foo'), $criteria);
- $that->assertEquals(array('upsert' => true, 'multiple' =>
false), $options);
+
+ if (phpversion('mongodb')) {
+ $that->assertEquals(array('upsert' => true), $options);
+ } else {
+ $that->assertEquals(array('upsert' => true, 'multiple' =>
false), $options);
+ }
$data = $updateData['$set'];
}));
@@ -135,10 +163,17 @@
$expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime');
$this->assertTrue($this->storage->write('foo', 'bar'));
- $this->assertEquals('bar', $data[$this->options['data_field']]->bin);
- $that->assertInstanceOf('MongoDate',
$data[$this->options['time_field']]);
- $this->assertInstanceOf('MongoDate',
$data[$this->options['expiry_field']]);
- $this->assertGreaterThanOrEqual($expectedExpiry,
$data[$this->options['expiry_field']]->sec);
+ if (phpversion('mongodb')) {
+ $that->assertEquals('bar',
$data[$that->options['data_field']]->getData());
+ $that->assertInstanceOf('MongoDB\BSON\UTCDateTime',
$data[$that->options['time_field']]);
+ $that->assertInstanceOf('MongoDB\BSON\UTCDateTime',
$data[$that->options['expiry_field']]);
+ $that->assertGreaterThanOrEqual($expectedExpiry,
round(intval((string) $data[$that->options['expiry_field']]) / 1000));
+ } else {
+ $that->assertEquals('bar',
$data[$that->options['data_field']]->bin);
+ $that->assertInstanceOf('MongoDate',
$data[$that->options['time_field']]);
+ $that->assertInstanceOf('MongoDate',
$data[$that->options['expiry_field']]);
+ $that->assertGreaterThanOrEqual($expectedExpiry,
$data[$that->options['expiry_field']]->sec);
+ }
}
public function testWriteWhenUsingExpiresField()
@@ -164,20 +199,33 @@
$that = $this;
$data = array();
+ $methodName = phpversion('mongodb') ? 'updateOne' : 'update';
+
$collection->expects($this->once())
- ->method('update')
+ ->method($methodName)
->will($this->returnCallback(function ($criteria, $updateData,
$options) use ($that, &$data) {
$that->assertEquals(array($that->options['id_field'] =>
'foo'), $criteria);
- $that->assertEquals(array('upsert' => true, 'multiple' =>
false), $options);
+
+ if (phpversion('mongodb')) {
+ $that->assertEquals(array('upsert' => true), $options);
+ } else {
+ $that->assertEquals(array('upsert' => true, 'multiple' =>
false), $options);
+ }
$data = $updateData['$set'];
}));
$this->assertTrue($this->storage->write('foo', 'bar'));
- $this->assertEquals('bar', $data[$this->options['data_field']]->bin);
- $that->assertInstanceOf('MongoDate',
$data[$this->options['time_field']]);
- $that->assertInstanceOf('MongoDate',
$data[$this->options['expiry_field']]);
+ if (phpversion('mongodb')) {
+ $that->assertEquals('bar',
$data[$that->options['data_field']]->getData());
+ $that->assertInstanceOf('MongoDB\BSON\UTCDateTime',
$data[$that->options['time_field']]);
+ $that->assertInstanceOf('MongoDB\BSON\UTCDateTime',
$data[$that->options['expiry_field']]);
+ } else {
+ $that->assertEquals('bar',
$data[$that->options['data_field']]->bin);
+ $that->assertInstanceOf('MongoDate',
$data[$that->options['time_field']]);
+ $that->assertInstanceOf('MongoDate',
$data[$that->options['expiry_field']]);
+ }
}
public function testReplaceSessionData()
@@ -191,8 +239,10 @@
$data = array();
+ $methodName = phpversion('mongodb') ? 'updateOne' : 'update';
+
$collection->expects($this->exactly(2))
- ->method('update')
+ ->method($methodName)
->will($this->returnCallback(function ($criteria, $updateData,
$options) use (&$data) {
$data = $updateData;
}));
@@ -200,7 +250,11 @@
$this->storage->write('foo', 'bar');
$this->storage->write('foo', 'foobar');
- $this->assertEquals('foobar',
$data['$set'][$this->options['data_field']]->bin);
+ if (phpversion('mongodb')) {
+ $this->assertEquals('foobar',
$data['$set'][$this->options['data_field']]->getData());
+ } else {
+ $this->assertEquals('foobar',
$data['$set'][$this->options['data_field']]->bin);
+ }
}
public function testDestroy()
@@ -212,8 +266,10 @@
->with($this->options['database'], $this->options['collection'])
->will($this->returnValue($collection));
+ $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';
+
$collection->expects($this->once())
- ->method('remove')
+ ->method($methodName)
->with(array($this->options['id_field'] => 'foo'));
$this->assertTrue($this->storage->destroy('foo'));
@@ -230,19 +286,45 @@
$that = $this;
+ $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';
+
$collection->expects($this->once())
- ->method('remove')
+ ->method($methodName)
->will($this->returnCallback(function ($criteria) use ($that) {
- $that->assertInstanceOf('MongoDate',
$criteria[$that->options['expiry_field']]['$lt']);
- $that->assertGreaterThanOrEqual(time() - 1,
$criteria[$that->options['expiry_field']]['$lt']->sec);
+ if (phpversion('mongodb')) {
+ $that->assertInstanceOf('MongoDB\BSON\UTCDateTime',
$criteria[$that->options['expiry_field']]['$lt']);
+ $that->assertGreaterThanOrEqual(time() - 1,
round(intval((string) $criteria[$that->options['expiry_field']]['$lt']) /
1000));
+ } else {
+ $that->assertInstanceOf('MongoDate',
$criteria[$that->options['expiry_field']]['$lt']);
+ $that->assertGreaterThanOrEqual(time() - 1,
$criteria[$that->options['expiry_field']]['$lt']->sec);
+ }
}));
$this->assertTrue($this->storage->gc(1));
}
+ public function testGetConnection()
+ {
+ $method = new \ReflectionMethod($this->storage, 'getMongo');
+ $method->setAccessible(true);
+
+ if (phpversion('mongodb')) {
+ $mongoClass = 'MongoDB\Client';
+ } else {
+ $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ?
'Mongo' : 'MongoClient';
+ }
+
+ $this->assertInstanceOf($mongoClass, $method->invoke($this->storage));
+ }
+
private function createMongoCollectionMock()
{
- $collection = $this->getMockBuilder('MongoCollection')
+ $collectionClass = 'MongoCollection';
+ if (phpversion('mongodb')) {
+ $collectionClass = 'MongoDB\Collection';
+ }
+
+ $collection = $this->getMockBuilder($collectionClass)
->disableOriginalConstructor()
->getMock();
diff --git a/symfony/yaml/Tests/ParserTest.php
b/symfony/yaml/Tests/ParserTest.php
index 7b36819..9e9a715 100644
--- a/symfony/yaml/Tests/ParserTest.php
+++ b/symfony/yaml/Tests/ParserTest.php
@@ -928,6 +928,7 @@
/**
* @group legacy
* throw ParseException in Symfony 3.0
+ * @requires function
Symfony\Bridge\PhpUnit\ErrorAssert::assertDeprecationsAreTriggered
*/
public function testColonInMappingValueException()
{
diff --git a/symfony/yaml/Yaml.php b/symfony/yaml/Yaml.php
index d5fbbee..6fc4e92 100644
--- a/symfony/yaml/Yaml.php
+++ b/symfony/yaml/Yaml.php
@@ -73,20 +73,20 @@
}
/**
- * Dumps a PHP array to a YAML string.
+ * Dumps a PHP value to a YAML string.
*
* The dump method, when supplied with an array, will do its best
* to convert the array into friendly YAML.
*
- * @param array $array PHP array
+ * @param mixed $input The PHP value
* @param int $inline The level where you switch to
inline YAML
* @param int $indent The amount of spaces to use for
indentation of nested nodes
* @param bool $exceptionOnInvalidType true if an exception must be
thrown on invalid types (a PHP resource or object), false otherwise
* @param bool $objectSupport true if object support is enabled,
false otherwise
*
- * @return string A YAML string representing the original PHP array
+ * @return string A YAML string representing the original PHP value
*/
- public static function dump($array, $inline = 2, $indent = 4,
$exceptionOnInvalidType = false, $objectSupport = false)
+ public static function dump($input, $inline = 2, $indent = 4,
$exceptionOnInvalidType = false, $objectSupport = false)
{
if ($indent < 1) {
throw new \InvalidArgumentException('The indentation must be
greater than zero.');
@@ -95,6 +95,6 @@
$yaml = new Dumper();
$yaml->setIndentation($indent);
- return $yaml->dump($array, $inline, 0, $exceptionOnInvalidType,
$objectSupport);
+ return $yaml->dump($input, $inline, 0, $exceptionOnInvalidType,
$objectSupport);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/307625
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iede6fe959fdf4381243ce78acb66545a5776b2a1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig/vendor
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits