]> git.mxchange.org Git - friendica-addons.git/commitdiff
[monolog] Update Composer dependencies ahead of release
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 20 Mar 2024 02:46:48 +0000 (22:46 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 20 Mar 2024 03:10:09 +0000 (23:10 -0400)
- Updating monolog/monolog (2.9.1 => 2.9.2)

12 files changed:
monolog/composer.json
monolog/composer.lock
monolog/vendor/composer/autoload_classmap.php
monolog/vendor/composer/autoload_static.php
monolog/vendor/composer/installed.json
monolog/vendor/monolog/monolog/CHANGELOG.md
monolog/vendor/monolog/monolog/UPGRADE.md [new file with mode: 0644]
monolog/vendor/monolog/monolog/src/Monolog/ErrorHandler.php
monolog/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php
monolog/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php [new file with mode: 0644]

index 7bcb4995df2251896cdec5b1f417c83cc26b8475..9cf42dbe88e2a620c6228d21202161e679d4f1b4 100644 (file)
@@ -1,23 +1,26 @@
 {
-  "name": "friendica-addons/monolog",
-  "description": "Monolog can send your logs to files, sockets, inboxes, database, etc..",
-  "type": "friendica-addon",
-  "authors": [
-       {
-         "name": "Philipp Holzer",
-         "email": "admin@philipp.info",
-         "homepage": "https://blog.philipp.info",
-         "role": "Developer"
-       }
-  ],
-  "require": {
-    "php": ">=7.3",
-    "monolog/monolog": "^2.9"
-  },
-  "license": "3-clause BSD license",
-  "config": {
-       "optimize-autoloader": true,
-       "autoloader-suffix": "MonologAddon",
-       "preferred-install": "dist"
-  }
+    "name": "friendica-addons/monolog",
+    "description": "Monolog can send your logs to files, sockets, inboxes, database, etc..",
+    "type": "friendica-addon",
+    "authors": [
+        {
+            "name": "Philipp Holzer",
+            "email": "admin@philipp.info",
+            "homepage": "https://blog.philipp.info",
+            "role": "Developer"
+        }
+    ],
+    "require": {
+        "php": ">=7.3",
+        "monolog/monolog": "^2.9"
+    },
+    "license": "3-clause BSD license",
+    "config": {
+        "platform": {
+            "php": "7.4"
+        },
+        "optimize-autoloader": true,
+        "autoloader-suffix": "MonologAddon",
+        "preferred-install": "dist"
+    }
 }
index f73b2ef033479a395d88cc79fdf3afbfb6ae4408..5d1da32f95db6585d5a4d23e9561cc041df4dd7f 100644 (file)
@@ -4,20 +4,20 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "6fd294bd163b37ac6cc400e0f8785222",
+    "content-hash": "037f2db47e77c9af2960dde65ebafa8d",
     "packages": [
         {
             "name": "monolog/monolog",
-            "version": "2.9.1",
+            "version": "2.9.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Seldaek/monolog.git",
-                "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1"
+                "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1",
-                "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1",
+                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437cb3628f4cf6042cc10ae97fc2b8472e48ca1f",
+                "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f",
                 "shasum": ""
             },
             "require": {
                     "type": "tidelift"
                 }
             ],
-            "time": "2023-02-06T13:44:46+00:00"
+            "time": "2023-10-27T15:25:26+00:00"
         },
         {
             "name": "psr/log",
         "php": ">=7.3"
     },
     "platform-dev": [],
+    "platform-overrides": {
+        "php": "7.4"
+    },
     "plugin-api-version": "1.1.0"
 }
index 3c89f22cb76e927ecd7750bbd153df8ef9348693..c12d7340ae45efdf612b841022f86ce16cb33f5d 100644 (file)
@@ -121,15 +121,4 @@ return array(
     'Monolog\\SignalHandler' => $vendorDir . '/monolog/monolog/src/Monolog/SignalHandler.php',
     'Monolog\\Test\\TestCase' => $vendorDir . '/monolog/monolog/src/Monolog/Test/TestCase.php',
     'Monolog\\Utils' => $vendorDir . '/monolog/monolog/src/Monolog/Utils.php',
-    'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
-    'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
-    'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php',
-    'Psr\\Log\\LoggerAwareInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareInterface.php',
-    'Psr\\Log\\LoggerAwareTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerAwareTrait.php',
-    'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php',
-    'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php',
-    'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php',
-    'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/DummyTest.php',
-    'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
-    'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php',
 );
index 95ed9e754a5571850ea21a604826cce83ed6ee0e..a44984ec9baa57c5840449cb12eee3098c313c53 100644 (file)
@@ -144,17 +144,6 @@ class ComposerStaticInitMonologAddon
         'Monolog\\SignalHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/SignalHandler.php',
         'Monolog\\Test\\TestCase' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Test/TestCase.php',
         'Monolog\\Utils' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Utils.php',
-        'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
-        'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
-        'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php',
-        'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareInterface.php',
-        'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerAwareTrait.php',
-        'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php',
-        'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php',
-        'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php',
-        'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php',
-        'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php',
-        'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php',
     );
 
     public static function getInitializer(ClassLoader $loader)
index ea2bb1784a885ea2fdb8c9be3a0d844fa502ba6c..2b1294170cbff63c8402d4bbf725ca5639ad9341 100644 (file)
@@ -1,17 +1,17 @@
 [
     {
         "name": "monolog/monolog",
-        "version": "2.9.1",
-        "version_normalized": "2.9.1.0",
+        "version": "2.9.2",
+        "version_normalized": "2.9.2.0",
         "source": {
             "type": "git",
             "url": "https://github.com/Seldaek/monolog.git",
-            "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1"
+            "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1",
-            "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1",
+            "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437cb3628f4cf6042cc10ae97fc2b8472e48ca1f",
+            "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f",
             "shasum": ""
         },
         "require": {
@@ -57,7 +57,7 @@
             "rollbar/rollbar": "Allow sending log messages to Rollbar",
             "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
         },
-        "time": "2023-02-06T13:44:46+00:00",
+        "time": "2023-10-27T15:25:26+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
index 8a8c651244642eefe7908bbd7af811236834886a..aca1bdd0d727904d9436d4027ddb4142e4bd61ce 100644 (file)
@@ -1,3 +1,9 @@
+### 2.9.2 (2023-10-27)
+
+  * Fixed display_errors parsing in ErrorHandler which did not support string values (#1804)
+  * Fixed bug where the previous error handler would not be restored in some cases where StreamHandler fails (#1815)
+  * Fixed normalization error when normalizing incomplete classes (#1833)
+
 ### 2.9.1 (2023-02-06)
 
   * Fixed Logger not being serializable anymore (#1792)
diff --git a/monolog/vendor/monolog/monolog/UPGRADE.md b/monolog/vendor/monolog/monolog/UPGRADE.md
new file mode 100644 (file)
index 0000000..84e15e6
--- /dev/null
@@ -0,0 +1,72 @@
+### 2.0.0
+
+- `Monolog\Logger::API` can be used to distinguish between a Monolog `1` and `2`
+  install of Monolog when writing integration code.
+
+- Removed non-PSR-3 methods to add records, all the `add*` (e.g. `addWarning`)
+  methods as well as `emerg`, `crit`, `err` and `warn`.
+
+- DateTime are now formatted with a timezone and microseconds (unless disabled).
+  Various formatters and log output might be affected, which may mess with log parsing
+  in some cases.
+
+- The `datetime` in every record array is now a DateTimeImmutable, not that you
+  should have been modifying these anyway.
+
+- The timezone is now set per Logger instance and not statically, either
+  via ->setTimezone or passed in the constructor. Calls to Logger::setTimezone
+  should be converted.
+
+- `HandlerInterface` has been split off and two new interfaces now exist for
+  more granular controls: `ProcessableHandlerInterface` and
+  `FormattableHandlerInterface`. Handlers not extending `AbstractHandler`
+  should make sure to implement the relevant interfaces.
+
+- `HandlerInterface` now requires the `close` method to be implemented. This
+  only impacts you if you implement the interface yourself, but you can extend
+  the new `Monolog\Handler\Handler` base class too.
+
+- There is no more default handler configured on empty Logger instances, if
+  you were relying on that you will not get any output anymore, make sure to
+  configure the handler you need.
+
+#### LogglyFormatter
+
+- The records' `datetime` is not sent anymore. Only `timestamp` is sent to Loggly.
+
+#### AmqpHandler
+
+- Log levels are not shortened to 4 characters anymore. e.g. a warning record
+  will be sent using the `warning.channel` routing key instead of `warn.channel`
+  as in 1.x.
+- The exchange name does not default to 'log' anymore, and it is completely ignored
+  now for the AMQP extension users. Only PHPAmqpLib uses it if provided.
+
+#### RotatingFileHandler
+
+- The file name format must now contain `{date}` and the date format must be set
+  to one of the predefined FILE_PER_* constants to avoid issues with file rotation.
+  See `setFilenameFormat`.
+
+#### LogstashFormatter
+
+- Removed Logstash V0 support
+- Context/extra prefix has been removed in favor of letting users configure the exact key being sent
+- Context/extra data are now sent as an object instead of single keys
+
+#### HipChatHandler
+
+- Removed deprecated HipChat handler, migrate to Slack and use SlackWebhookHandler or SlackHandler instead
+
+#### SlackbotHandler
+
+- Removed deprecated SlackbotHandler handler, use SlackWebhookHandler or SlackHandler instead
+
+#### RavenHandler
+
+- Removed deprecated RavenHandler handler, use sentry/sentry 2.x and their Sentry\Monolog\Handler instead
+
+#### ElasticSearchHandler
+
+- As support for the official Elasticsearch library was added, the former ElasticSearchHandler has been
+  renamed to ElasticaHandler and the new one added as ElasticsearchHandler.
index 576f1713f04c2034a7ab5ced65692b52e5675c1b..1406d34e82e5bde025324bbd93d54088957dbe6a 100644 (file)
@@ -198,7 +198,7 @@ class ErrorHandler
             ($this->previousExceptionHandler)($e);
         }
 
-        if (!headers_sent() && !ini_get('display_errors')) {
+        if (!headers_sent() && in_array(strtolower((string) ini_get('display_errors')), ['0', '', 'false', 'off', 'none', 'no'], true)) {
             http_response_code(500);
         }
 
index b31b2971a14e98f6a1fbb4c490b6a5fab951df3d..e6e7898336a474c24475d6e023d47a8e96153396 100644 (file)
@@ -155,7 +155,7 @@ class LineFormatter extends NormalizerFormatter
             do {
                 $depth++;
                 if ($depth > $this->maxNormalizeDepth) {
-                    $str .= '\n[previous exception] Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization';
+                    $str .= "\n[previous exception] Over " . $this->maxNormalizeDepth . ' levels deep, aborting normalization';
                     break;
                 }
 
index 5441bc0aadb521beef20e2b7417e8364a8efb6d3..f926a842f8e35763092670b6296d17c90908f148 100644 (file)
@@ -174,6 +174,9 @@ class NormalizerFormatter implements FormatterInterface
             if ($data instanceof \JsonSerializable) {
                 /** @var null|scalar|array<array|scalar|null> $value */
                 $value = $data->jsonSerialize();
+            } elseif (\get_class($data) === '__PHP_Incomplete_Class') {
+                $accessor = new \ArrayObject($data);
+                $value = (string) $accessor['__PHP_Incomplete_Class_Name'];
             } elseif (method_exists($data, '__toString')) {
                 /** @var string $value */
                 $value = $data->__toString();
index 651835122ec253112090b6a00beeb4816329f393..82c048e1c82ae28798e63a289c830717e04cf101 100644 (file)
@@ -135,11 +135,14 @@ class StreamHandler extends AbstractProcessingHandler
             $this->createDir($url);
             $this->errorMessage = null;
             set_error_handler([$this, 'customErrorHandler']);
-            $stream = fopen($url, 'a');
-            if ($this->filePermission !== null) {
-                @chmod($url, $this->filePermission);
+            try {
+                $stream = fopen($url, 'a');
+                if ($this->filePermission !== null) {
+                    @chmod($url, $this->filePermission);
+                }
+            } finally {
+                restore_error_handler();
             }
-            restore_error_handler();
             if (!is_resource($stream)) {
                 $this->stream = null;
 
diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php
new file mode 100644 (file)
index 0000000..fae9251
--- /dev/null
@@ -0,0 +1,115 @@
+<?php declare(strict_types=1);
+
+/*
+ * This file is part of the Monolog package.
+ *
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Utils;
+use Monolog\Formatter\FormatterInterface;
+use Monolog\Formatter\LineFormatter;
+use Swift_Message;
+use Swift;
+
+/**
+ * SwiftMailerHandler uses Swift_Mailer to send the emails
+ *
+ * @author Gyula Sallai
+ *
+ * @phpstan-import-type Record from \Monolog\Logger
+ * @deprecated Since Monolog 2.6. Use SymfonyMailerHandler instead.
+ */
+class SwiftMailerHandler extends MailHandler
+{
+    /** @var \Swift_Mailer */
+    protected $mailer;
+    /** @var Swift_Message|callable(string, Record[]): Swift_Message */
+    private $messageTemplate;
+
+    /**
+     * @psalm-param Swift_Message|callable(string, Record[]): Swift_Message $message
+     *
+     * @param \Swift_Mailer          $mailer  The mailer to use
+     * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced
+     */
+    public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, bool $bubble = true)
+    {
+        parent::__construct($level, $bubble);
+
+        @trigger_error('The SwiftMailerHandler is deprecated since Monolog 2.6. Use SymfonyMailerHandler instead.', E_USER_DEPRECATED);
+
+        $this->mailer = $mailer;
+        $this->messageTemplate = $message;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected function send(string $content, array $records): void
+    {
+        $this->mailer->send($this->buildMessage($content, $records));
+    }
+
+    /**
+     * Gets the formatter for the Swift_Message subject.
+     *
+     * @param string|null $format The format of the subject
+     */
+    protected function getSubjectFormatter(?string $format): FormatterInterface
+    {
+        return new LineFormatter($format);
+    }
+
+    /**
+     * Creates instance of Swift_Message to be sent
+     *
+     * @param  string        $content formatted email body to be sent
+     * @param  array         $records Log records that formed the content
+     * @return Swift_Message
+     *
+     * @phpstan-param Record[] $records
+     */
+    protected function buildMessage(string $content, array $records): Swift_Message
+    {
+        $message = null;
+        if ($this->messageTemplate instanceof Swift_Message) {
+            $message = clone $this->messageTemplate;
+            $message->generateId();
+        } elseif (is_callable($this->messageTemplate)) {
+            $message = ($this->messageTemplate)($content, $records);
+        }
+
+        if (!$message instanceof Swift_Message) {
+            $record = reset($records);
+            throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it' . ($record ? Utils::getRecordMessageForException($record) : ''));
+        }
+
+        if ($records) {
+            $subjectFormatter = $this->getSubjectFormatter($message->getSubject());
+            $message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
+        }
+
+        $mime = 'text/plain';
+        if ($this->isHtmlBody($content)) {
+            $mime = 'text/html';
+        }
+
+        $message->setBody($content, $mime);
+        /** @phpstan-ignore-next-line */
+        if (version_compare(Swift::VERSION, '6.0.0', '>=')) {
+            $message->setDate(new \DateTimeImmutable());
+        } else {
+            /** @phpstan-ignore-next-line */
+            $message->setDate(time());
+        }
+
+        return $message;
+    }
+}