diff --git a/.editorconfig b/.editorconfig index ef6e90b2..8565b274 100644 --- a/.editorconfig +++ b/.editorconfig @@ -27,6 +27,3 @@ indent_size = 2 [*.json] indent_style = space indent_size = 2 - -[composer.json] -indent_size = 4 diff --git a/.woodpecker/.code_standards_check.yml b/.woodpecker/.code_standards_check.yml index 60a1bd2a..9d59dc08 100644 --- a/.woodpecker/.code_standards_check.yml +++ b/.woodpecker/.code_standards_check.yml @@ -1,12 +1,9 @@ skip_clone: true -steps: +pipeline: clone_friendica_base: image: alpine/git commands: - - git config --global user.email "no-reply@friendi.ca" - - git config --global user.name "Friendica" - - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -16,7 +13,7 @@ steps: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_CLONE_URL addon + - git clone $CI_REPO_LINK addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF @@ -56,10 +53,6 @@ steps: - /tmp/drone-cache:/tmp/cache when: event: pull_request - phpstan: - image: friendicaci/php8.3:php8.3.3 - commands: - - ./bin/composer.phar run phpstan; check: image: friendicaci/php-cs commands: diff --git a/.woodpecker/.continuous-deployment.yml b/.woodpecker/.continuous-deployment.yml index d6d8a22a..ab6e07e9 100644 --- a/.woodpecker/.continuous-deployment.yml +++ b/.woodpecker/.continuous-deployment.yml @@ -5,13 +5,10 @@ labels: skip_clone: true -steps: +pipeline: clone_friendica_base: image: alpine/git commands: - - git config --global user.email "no-reply@friendi.ca" - - git config --global user.name "Friendica" - - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -23,7 +20,7 @@ steps: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_CLONE_URL addon + - git clone $CI_REPO_LINK addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF @@ -48,7 +45,7 @@ steps: branch: [ develop, '*-rc' ] event: push composer_install: - image: friendicaci/php8.2:php8.2.28 + image: friendicaci/php7.4:php7.4.33 commands: - export COMPOSER_HOME=.composer - composer validate diff --git a/.woodpecker/.messages.po_check.yml b/.woodpecker/.messages.po_check.yml index e0239dcd..f5691e00 100644 --- a/.woodpecker/.messages.po_check.yml +++ b/.woodpecker/.messages.po_check.yml @@ -1,12 +1,9 @@ skip_clone: true -steps: +pipeline: clone_friendica_base: image: alpine/git commands: - - git config --global user.email "no-reply@friendi.ca" - - git config --global user.name "Friendica" - - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -16,7 +13,7 @@ steps: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_CLONE_URL addon + - git clone $CI_REPO_LINK addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml deleted file mode 100644 index b0745ad0..00000000 --- a/.woodpecker/.phpunit.yml +++ /dev/null @@ -1,120 +0,0 @@ -matrix: - include: - - PHP_MAJOR_VERSION: 7.4 - PHP_VERSION: 7.4.33 - - PHP_MAJOR_VERSION: 8.0 - PHP_VERSION: 8.0.30 - - PHP_MAJOR_VERSION: 8.1 - PHP_VERSION: 8.1.31 - - PHP_MAJOR_VERSION: 8.2 - PHP_VERSION: 8.2.28 - - PHP_MAJOR_VERSION: 8.3 - PHP_VERSION: 8.3.17 - - PHP_MAJOR_VERSION: 8.4 - PHP_VERSION: 8.4.5 - -# This forces PHP Unit executions at the "opensocial" labeled location (because of much more power...) -labels: - location: opensocial - -skip_clone: true - -steps: - clone_friendica_base: - image: alpine/git - commands: - - git config --global user.email "no-reply@friendi.ca" - - git config --global user.name "Friendica" - - git config --global --add safe.directory $CI_WORKSPACE - - git clone https://github.com/friendica/friendica.git . - - git checkout $CI_COMMIT_BRANCH - clone_friendica_addon: - image: alpine/git - commands: - - git config --global user.email "no-reply@friendi.ca" - - git config --global user.name "Friendica" - - git clone $CI_REPO_CLONE_URL addon - - cd addon/ - - git checkout $CI_COMMIT_BRANCH - - git fetch origin $CI_COMMIT_REF - - git merge $CI_COMMIT_SHA - restore_cache: - image: meltwater/drone-cache:dev - settings: - backend: "filesystem" - restore: true - cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}" - archive_format: "gzip" - mount: - - '.composer' - volumes: - - /tmp/drone-cache:/tmp/cache - composer_install: - image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION} - commands: - - export COMPOSER_HOME=.composer - - ./bin/composer.phar validate - - ./bin/composer.phar install --prefer-dist - volumes: - - /etc/hosts:/etc/hosts - rebuild_cache: - image: meltwater/drone-cache:dev - settings: - backend: "filesystem" - rebuild: true - cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}" - archive_format: "gzip" - mount: - - '.composer' - volumes: - - /tmp/drone-cache:/tmp/cache - test: - image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION} - environment: - MYSQL_HOST: "mariadb" - MYSQL_PORT: "3306" - MYSQL_DATABASE: "test" - MYSQL_PASSWORD: "test" - MYSQL_USER: "test" - REDIS_HOST: "redis" - MEMCACHED_HOST: "memcached" - MEMCACHE_HOST: "memcached" - commands: - - cp config/local-sample.config.php config/local.config.php - - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi - - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql - - if [ "${PHP_MAJOR_VERSION}" = "8.2" -a "${CI_REPO}" = "friendica/friendica-addons" ]; then - phpenmod xdebug; - export XDEBUG_MODE=coverage; - phpunit --configuration tests/phpunit-addons.xml --coverage-clover clover.xml; - else - phpunit --configuration tests/phpunit-addons.xml; - fi - codecov: - image: friendicaci/codecov - when: - matrix: - PHP_MAJOR_VERSION: 8.2 - PHP_VERSION: 8.2.16 - repo: - - friendica/friendica-addons - commands: - - codecov -R '.' -Z -f 'clover.xml' - environment: - CODECOV_TOKEN: - from_secret: codecov-token - -services: - mariadb: - image: mariadb:latest - environment: - MYSQL_ALLOW_EMPTY_PASSWORD: "true" - MYSQL_DATABASE: "test" - MYSQL_PASSWORD: "test" - MYSQL_USER: "test" - - memcached: - image: memcached - - redis: - image: redis diff --git a/.woodpecker/.releaser.yml b/.woodpecker/.releaser.yml index 7407f2bc..4a661937 100644 --- a/.woodpecker/.releaser.yml +++ b/.woodpecker/.releaser.yml @@ -5,13 +5,10 @@ labels: skip_clone: true -steps: +pipeline: clone_friendica_base: image: alpine/git commands: - - git config --global user.email "no-reply@friendi.ca" - - git config --global user.name "Friendica" - - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -22,7 +19,7 @@ steps: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_CLONE_URL addon + - git clone $CI_REPO_LINK addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF @@ -45,7 +42,7 @@ steps: repo: friendica/friendica-addons event: tag composer_install: - image: friendicaci/php8.2:php8.2.28 + image: friendicaci/php7.4:php7.4.33 commands: - export COMPOSER_HOME=.composer - composer validate diff --git a/advancedcontentfilter/advancedcontentfilter.js b/advancedcontentfilter/advancedcontentfilter.js index a8fc1c65..fcf7b096 100644 --- a/advancedcontentfilter/advancedcontentfilter.js +++ b/advancedcontentfilter/advancedcontentfilter.js @@ -54,7 +54,7 @@ new Vue({ self.rules.push(responseJSON.rule); self.resetForm(); }, function (response) { - self.errorMessage = response.responseJSON.exception[0].message; + self.errorMessage = response.responseJSON.message; }); } }, @@ -74,7 +74,7 @@ new Vue({ self.rules[self.editedIndex] = rule; self.resetForm(); }, function (response) { - self.errorMessage = response.responseJSON.exception[0].message; + self.errorMessage = response.responseJSON.message; }); }, diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 53cb9ebe..2254e587 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -33,13 +33,16 @@ * */ +use Friendica\App; use Friendica\BaseModule; use Friendica\Content\Text\Markdown; use Friendica\Core\Hook; +use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\DI; +use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; @@ -61,7 +64,7 @@ function advancedcontentfilter_install() Hook::add('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition'); DBStructure::performUpdate(); - DI::logger()->notice('installed advancedcontentfilter'); + Logger::notice('installed advancedcontentfilter'); } /* @@ -120,22 +123,21 @@ function advancedcontentfilter_prepare_body_content_filter(&$hook_data) $expressionLanguage = new ExpressionLanguage\ExpressionLanguage(); } - $uid = $hook_data['uid'] ?? DI::userSession()->getLocalUserId(); - if (!$uid) { + if (!DI::userSession()->getLocalUserId()) { return; } $vars = advancedcontentfilter_get_filter_fields($hook_data['item']); - $rules = DI::cache()->get('rules_' . $uid); + $rules = DI::cache()->get('rules_' . DI::userSession()->getLocalUserId()); if (!isset($rules)) { $rules = DBA::toArray(DBA::select( 'advancedcontentfilter_rules', ['name', 'expression', 'serialized'], - ['uid' => $uid, 'active' => true] + ['uid' => DI::userSession()->getLocalUserId(), 'active' => true] )); - DI::cache()->set('rules_' . $uid, $rules); + DI::cache()->set('rules_' . DI::userSession()->getLocalUserId(), $rules); } if ($rules) { @@ -188,32 +190,11 @@ function advancedcontentfilter_module() {} function advancedcontentfilter_init() { if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') { - $slim = \Slim\Factory\AppFactory::create(); + $slim = new \Slim\App(); - /** - * The routing middleware should be added before the ErrorMiddleware - * Otherwise exceptions thrown from it will not be handled - */ - $slim->addRoutingMiddleware(); - - $slim->addErrorMiddleware(true, true, true, DI::logger()); - - // register routes - $slim->group('/advancedcontentfilter/api', function (\Slim\Routing\RouteCollectorProxy $app) { - $app->group('/rules', function (\Slim\Routing\RouteCollectorProxy $app) { - $app->get('', 'advancedcontentfilter_get_rules'); - $app->post('', 'advancedcontentfilter_post_rules'); - - $app->get('/{id}', 'advancedcontentfilter_get_rules_id'); - $app->put('/{id}', 'advancedcontentfilter_put_rules_id'); - $app->delete('/{id}', 'advancedcontentfilter_delete_rules_id'); - }); - - $app->group('/variables', function (\Slim\Routing\RouteCollectorProxy $app) { - $app->get('/{guid}', 'advancedcontentfilter_get_variables_guid'); - }); - }); + require __DIR__ . '/src/middlewares.php'; + require __DIR__ . '/src/routes.php'; $slim->run(); exit; @@ -271,8 +252,8 @@ function advancedcontentfilter_content() 'rule_expression' => DI::l10n()->t('Rule Expression'), 'cancel' => DI::l10n()->t('Cancel'), ], - '$current_theme' => DI::appHelper()->getCurrentTheme(), - '$rules' => DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => DI::userSession()->getLocalUserId()])), + '$current_theme' => DI::app()->getCurrentTheme(), + '$rules' => advancedcontentfilter_get_rules(), '$form_security_token' => BaseModule::getFormSecurityToken() ]); } @@ -324,7 +305,7 @@ function advancedcontentfilter_build_fields($data) * API */ -function advancedcontentfilter_get_rules(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface +function advancedcontentfilter_get_rules() { if (!DI::userSession()->getLocalUserId()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method')); @@ -332,8 +313,7 @@ function advancedcontentfilter_get_rules(ServerRequestInterface $request, Respon $rules = DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => DI::userSession()->getLocalUserId()])); - $response->getBody()->write(json_encode($rules)); - return $response->withHeader('Content-Type', 'application/json'); + return json_encode($rules); } function advancedcontentfilter_get_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -344,11 +324,10 @@ function advancedcontentfilter_get_rules_id(ServerRequestInterface $request, Res $rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => $args['id'], 'uid' => DI::userSession()->getLocalUserId()]); - $response->getBody()->write(json_encode($rule)); - return $response->withHeader('Content-Type', 'application/json'); + return json_encode($rule); } -function advancedcontentfilter_post_rules(ServerRequestInterface $request, ResponseInterface $response) +function advancedcontentfilter_post_rules(ServerRequestInterface $request) { if (!DI::userSession()->getLocalUserId()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method')); @@ -381,8 +360,7 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request, Respo DI::cache()->delete('rules_' . DI::userSession()->getLocalUserId()); - $response->getBody()->write(json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule])); - return $response->withHeader('Content-Type', 'application/json'); + return json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule]); } function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -413,8 +391,7 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res DI::cache()->delete('rules_' . DI::userSession()->getLocalUserId()); - $response->getBody()->write(json_encode(['message' => DI::l10n()->t('Rule successfully updated')])); - return $response->withHeader('Content-Type', 'application/json'); + return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]); } function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -437,8 +414,7 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request, DI::cache()->delete('rules_' . DI::userSession()->getLocalUserId()); - $response->getBody()->write(json_encode(['message' => DI::l10n()->t('Rule successfully deleted')])); - return $response->withHeader('Content-Type', 'application/json'); + return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]); } function advancedcontentfilter_get_variables_guid(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -461,8 +437,7 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques $return = advancedcontentfilter_get_filter_fields(advancedcontentfilter_prepare_item_row($item_row)); - $response->getBody()->write(json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))])); - return $response->withHeader('Content-Type', 'application/json'); + return json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))]); } /** @@ -480,7 +455,7 @@ function advancedcontentfilter_prepare_item_row(array $item_row): array $item_row['tags'] = $tags['tags']; $item_row['hashtags'] = $tags['hashtags']; $item_row['mentions'] = $tags['mentions']; - $item_row['attachments'] = DI::postMediaRepository()->splitAttachments($item_row['uri-id']); + $item_row['attachments'] = Post\Media::splitAttachments($item_row['uri-id']); return $item_row; } diff --git a/advancedcontentfilter/composer.json b/advancedcontentfilter/composer.json index b9ab1900..93b19cd5 100644 --- a/advancedcontentfilter/composer.json +++ b/advancedcontentfilter/composer.json @@ -1,27 +1,25 @@ { - "name": "friendica-addons/advancedcontentfilter", - "description": "Advanced Content Filter addon for Friendica", - "type": "friendica-addon", - "authors": [ - { - "name": "Hypolite Petovan", - "email": "hypolite@mrpetovan.com", - "homepage": "https://friendica.mrpetovan.com/profile/hypolite", - "role": "Developer" - } - ], - "require": { - "slim/slim": "^4", - "symfony/expression-language": "^3.4" - }, - "license": "3-clause BSD license", - "minimum-stability": "stable", - "config": { - "platform": { - "php": "7.4" - }, - "optimize-autoloader": true, - "autoloader-suffix": "AdvancedContentFilterAddon", - "preferred-install": "dist" - } + "name": "friendica-addons/advancedcontentfilter", + "description": "Advanced Content Filter addon for Friendica", + "type": "friendica-addon", + "authors": [ + { + "name": "Hypolite Petovan", + "email": "hypolite@mrpetovan.com", + "homepage": "https://friendica.mrpetovan.com/profile/hypolite", + "role": "Developer" + } + ], + "require": { + "php": ">=5.6.0", + "slim/slim": "^3.1", + "symfony/expression-language": "^3.4" + }, + "license": "3-clause BSD license", + "minimum-stability": "stable", + "config": { + "optimize-autoloader": true, + "autoloader-suffix": "AdvancedContentFilterAddon", + "preferred-install": "dist" + } } diff --git a/advancedcontentfilter/composer.lock b/advancedcontentfilter/composer.lock index 6dbd17ba..774b5ec8 100644 --- a/advancedcontentfilter/composer.lock +++ b/advancedcontentfilter/composer.lock @@ -4,8 +4,40 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a7276eb2d2108a26699f69c750d02d27", + "content-hash": "d0e3662dd9d910ffe4f71d325bc39319", "packages": [ + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", + "time": "2017-02-14T19:40:03+00:00" + }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -52,6 +84,56 @@ ], "time": "2018-02-13T20:26:39+00:00" }, + { + "name": "pimple/pimple", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2018-01-21T07:42:36+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -100,22 +182,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=5.3.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -128,7 +215,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -140,25 +227,24 @@ "container-interop", "psr" ], - "time": "2021-11-05T16:50:12+00:00" + "time": "2017-02-14T16:28:37+00:00" }, { - "name": "psr/http-factory", - "version": "1.0.2", + "name": "psr/http-message", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", "shasum": "" }, "require": { - "php": ">=7.0.0", - "psr/http-message": "^1.0 || ^2.0" + "php": ">=5.3.0" }, "type": "library", "extra": { @@ -178,58 +264,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interfaces for PSR-7 HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "time": "2023-04-10T20:10:41+00:00" - }, - { - "name": "psr/http-message", - "version": "2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", - "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -242,126 +277,20 @@ "request", "response" ], - "time": "2023-04-04T09:54:51+00:00" - }, - { - "name": "psr/http-server-handler", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-server-handler.git", - "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", - "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "psr/http-message": "^1.0 || ^2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Server\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP server-side request handler", - "keywords": [ - "handler", - "http", - "http-interop", - "psr", - "psr-15", - "psr-7", - "request", - "response", - "server" - ], - "time": "2023-04-10T20:06:20+00:00" - }, - { - "name": "psr/http-server-middleware", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-server-middleware.git", - "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", - "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "psr/http-message": "^1.0 || ^2.0", - "psr/http-server-handler": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Server\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP server-side middleware", - "keywords": [ - "http", - "http-interop", - "middleware", - "psr", - "psr-15", - "psr-7", - "request", - "response" - ], - "time": "2023-04-11T06:14:47+00:00" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -385,7 +314,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -395,55 +324,84 @@ "psr", "psr-3" ], - "time": "2021-05-03T11:20:27+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { - "name": "slim/slim", - "version": "4.13.0", + "name": "psr/simple-cache", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "038fd5713d5a41636fdff0e8dcceedecdd17fc17" + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/038fd5713d5a41636fdff0e8dcceedecdd17fc17", - "reference": "038fd5713d5a41636fdff0e8dcceedecdd17fc17", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "shasum": "" }, "require": { - "ext-json": "*", - "nikic/fast-route": "^1.3", - "php": "^7.4 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.1 || ^2.0", - "psr/http-server-handler": "^1.0", - "psr/http-server-middleware": "^1.0", - "psr/log": "^1.1 || ^2.0 || ^3.0" + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "slim/slim", + "version": "3.9.2", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "4086d0106cf5a7135c69fce4161fe355a8feb118" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/4086d0106cf5a7135c69fce4161fe355a8feb118", + "reference": "4086d0106cf5a7135c69fce4161fe355a8feb118", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.2", + "nikic/fast-route": "^1.0", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" }, "require-dev": { - "adriansuter/php-autoload-override": "^1.4", - "ext-simplexml": "*", - "guzzlehttp/psr7": "^2.6", - "httpsoft/http-message": "^1.1", - "httpsoft/http-server-request": "^1.1", - "laminas/laminas-diactoros": "^2.17 || ^3", - "nyholm/psr7": "^1.8", - "nyholm/psr7-server": "^1.1", - "phpspec/prophecy": "^1.19", - "phpspec/prophecy-phpunit": "^2.1", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.6", - "slim/http": "^1.3", - "slim/psr7": "^1.6", - "squizlabs/php_codesniffer": "^3.9" - }, - "suggest": { - "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", - "ext-xml": "Needed to support XML format in BodyParsingMiddleware", - "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", - "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" }, "type": "library", "autoload": { @@ -456,100 +414,77 @@ "MIT" ], "authors": [ - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "https://joshlockhart.com" - }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" - }, { "name": "Rob Allen", "email": "rob@akrabat.com", "homepage": "http://akrabat.com" }, { - "name": "Pierre Berube", - "email": "pierre@lgse.com", - "homepage": "http://www.lgse.com" + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" }, { "name": "Gabriel Manricks", "email": "gmanricks@me.com", "homepage": "http://gabrielmanricks.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "https://www.slimframework.com", + "homepage": "https://slimframework.com", "keywords": [ "api", "framework", "micro", "router" ], - "funding": [ - { - "url": "https://opencollective.com/slimphp", - "type": "open_collective" - }, - { - "url": "https://tidelift.com/funding/github/packagist/slim/slim", - "type": "tidelift" - } - ], - "time": "2024-03-03T21:25:30+00:00" + "time": "2017-11-26T19:13:09+00:00" }, { "name": "symfony/cache", - "version": "v4.4.48", + "version": "v3.4.36", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "3b98ed664887ad197b8ede3da2432787212eb915" + "reference": "3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/3b98ed664887ad197b8ede3da2432787212eb915", - "reference": "3b98ed664887ad197b8ede3da2432787212eb915", + "url": "https://api.github.com/repos/symfony/cache/zipball/3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3", + "reference": "3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/cache": "^1.0|^2.0", - "psr/log": "^1|^2|^3", - "symfony/cache-contracts": "^1.1.7|^2", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.2|^5.0" + "php": "^5.5.9|>=7.0.8", + "psr/cache": "~1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "symfony/polyfill-apcu": "~1.1" }, "conflict": { - "doctrine/dbal": "<2.7", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4|>=5.0", - "symfony/var-dumper": "<4.4" + "symfony/var-dumper": "<3.3" }, "provide": { - "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0|2.0", - "symfony/cache-implementation": "1.0|2.0" + "psr/cache-implementation": "1.0", + "psr/simple-cache-implementation": "1.0" }, "require-dev": { "cache/integration-tests": "dev-master", - "doctrine/cache": "^1.6|^2.0", - "doctrine/dbal": "^2.7|^3.0", - "predis/predis": "^1.1", - "psr/simple-cache": "^1.0|^2.0", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^3.4|^4.1|^5.0", - "symfony/filesystem": "^4.4|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/var-dumper": "^4.4|^5.0" + "doctrine/cache": "~1.6", + "doctrine/dbal": "~2.4", + "predis/predis": "~1.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, "autoload": { "psr-4": { "Symfony\\Component\\Cache\\": "" @@ -572,188 +507,38 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides extended PSR-6, PSR-16 (and tags) implementations", + "description": "Symfony Cache component with PSR-6, PSR-16, and tags", "homepage": "https://symfony.com", "keywords": [ "caching", "psr6" ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-10-17T20:21:54+00:00" - }, - { - "name": "symfony/cache-contracts", - "version": "v2.5.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/cache-contracts.git", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0|^3.0" - }, - "suggest": { - "symfony/cache-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Cache\\": "" - } - }, - "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": "Generic abstractions related to caching", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-01-02T09:53:40+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v2.5.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.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": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2019-12-01T10:45:41+00:00" }, { "name": "symfony/expression-language", - "version": "v3.4.47", + "version": "v3.4.8", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "de38e66398fca1fcb9c48e80279910e6889cb28f" + "reference": "867e4d1f5d4e52435a8ffff6b24fd6a801582241" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/de38e66398fca1fcb9c48e80279910e6889cb28f", - "reference": "de38e66398fca1fcb9c48e80279910e6889cb28f", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/867e4d1f5d4e52435a8ffff6b24fd6a801582241", + "reference": "867e4d1f5d4e52435a8ffff6b24fd6a801582241", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/cache": "~3.1|~4.0", - "symfony/polyfill-php70": "~1.6" + "symfony/cache": "~3.1|~4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, "autoload": { "psr-4": { "Symfony\\Component\\ExpressionLanguage\\": "" @@ -778,345 +563,37 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2018-01-03T07:37:34+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.20.0", + "name": "symfony/polyfill-apcu", + "version": "v1.13.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" + "url": "https://github.com/symfony/polyfill-apcu.git", + "reference": "a8e961c841b9ec52927a87914f8820a1ad8f8116" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/a8e961c841b9ec52927a87914f8820a1ad8f8116", + "reference": "a8e961c841b9ec52927a87914f8820a1ad8f8116", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-main": "1.20-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "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 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-23T14:02:19+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", - "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "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 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v2.5.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" - }, - "conflict": { - "ext-psr": "<1.1|>=2" - }, - "suggest": { - "symfony/service-implementation": "" + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "dev-master": "1.13-dev" } }, "autoload": { "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "Symfony\\Polyfill\\Apcu\\": "" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-05-30T19:17:29+00:00" - }, - { - "name": "symfony/var-exporter", - "version": "v5.4.35", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-exporter.git", - "reference": "abb0a151b62d6b07e816487e20040464af96cae7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/abb0a151b62d6b07e816487e20040464af96cae7", - "reference": "abb0a151b62d6b07e816487e20040464af96cae7", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9|^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\VarExporter\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1133,31 +610,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "clone", - "construct", - "export", - "hydrate", - "instantiate", - "serialize" + "apcu", + "compatibility", + "polyfill", + "portable", + "shim" ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2019-11-27T13:56:44+00:00" } ], "packages-dev": [], @@ -1166,10 +628,8 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "platform-overrides": { - "php": "7.4" + "platform": { + "php": ">=5.6.0" }, - "plugin-api-version": "1.1.0" + "platform-dev": [] } diff --git a/advancedcontentfilter/lang/it/messages.po b/advancedcontentfilter/lang/it/messages.po index 325be52c..f32c5b94 100644 --- a/advancedcontentfilter/lang/it/messages.po +++ b/advancedcontentfilter/lang/it/messages.po @@ -5,7 +5,7 @@ # # Translators: # fabrixxm , 2018 -# Sylke Vicious , 2023 +# Sylke Vicious , 2021 # #, fuzzy msgid "" @@ -14,7 +14,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-05-11 08:54-0400\n" "PO-Revision-Date: 2018-05-24 06:41+0000\n" -"Last-Translator: Sylke Vicious , 2023\n" +"Last-Translator: Sylke Vicious , 2021\n" "Language-Team: Italian (https://app.transifex.com/Friendica/teams/12172/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -125,7 +125,7 @@ msgstr "Annulla" #: advancedcontentfilter.php:295 msgid "This addon requires this node having at least one post" -msgstr "Questo addon richiede che questo nodo abbia almeno un messaggio" +msgstr "" #: advancedcontentfilter.php:325 advancedcontentfilter.php:336 #: advancedcontentfilter.php:347 advancedcontentfilter.php:383 diff --git a/advancedcontentfilter/lang/it/strings.php b/advancedcontentfilter/lang/it/strings.php index d47d7a5a..5cc01739 100644 --- a/advancedcontentfilter/lang/it/strings.php +++ b/advancedcontentfilter/lang/it/strings.php @@ -27,7 +27,6 @@ $a->strings['Add new rule'] = 'Aggiungi nuova regola'; $a->strings['Rule Name'] = 'Nome Regola'; $a->strings['Rule Expression'] = 'Espressione Regola'; $a->strings['Cancel'] = 'Annulla'; -$a->strings['This addon requires this node having at least one post'] = 'Questo addon richiede che questo nodo abbia almeno un messaggio'; $a->strings['You must be logged in to use this method'] = 'Devi essere autenticato per usare questo metodo'; $a->strings['Invalid form security token, please refresh the page.'] = 'Token di sicurezza invalido, aggiorna la pagina.'; $a->strings['The rule name and expression are required.'] = 'Il nome e l\'espressione della regola sono richiesti.'; diff --git a/advancedcontentfilter/src/middlewares.php b/advancedcontentfilter/src/middlewares.php new file mode 100644 index 00000000..dffb9363 --- /dev/null +++ b/advancedcontentfilter/src/middlewares.php @@ -0,0 +1,51 @@ +. + * + */ + +use Friendica\DI; + +$container = $slim->getContainer(); + +// Error handler based off https://stackoverflow.com/a/48135009/757392 +$container['errorHandler'] = function () { + return function(Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, Exception $exception) + { + $responseCode = 500; + + if (is_a($exception, 'Friendica\Network\HTTPException')) { + $responseCode = $exception->getCode(); + } + + $errors['message'] = $exception->getMessage(); + + $errors['responseCode'] = $responseCode; + + return $response + ->withStatus($responseCode) + ->withJson($errors); + }; +}; + +$container['notFoundHandler'] = function () { + return function () + { + throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Method not found')); + }; +}; diff --git a/monolog/static/dependencies.config.php b/advancedcontentfilter/src/routes.php similarity index 52% rename from monolog/static/dependencies.config.php rename to advancedcontentfilter/src/routes.php index f992d69c..09077bda 100644 --- a/monolog/static/dependencies.config.php +++ b/advancedcontentfilter/src/routes.php @@ -1,6 +1,6 @@ [ - 'instanceOf' => \Friendica\Addon\monolog\src\Factory\MonologFactory::class, - 'call' => null, - ], -]; +/* @var $slim Slim\App */ +$slim->group('/advancedcontentfilter/api', function () { + /* @var $this Slim\App */ + $this->group('/rules', function () { + /* @var $this Slim\App */ + $this->get('', 'advancedcontentfilter_get_rules'); + $this->post('', 'advancedcontentfilter_post_rules'); + + $this->get('/{id}', 'advancedcontentfilter_get_rules_id'); + $this->put('/{id}', 'advancedcontentfilter_put_rules_id'); + $this->delete('/{id}', 'advancedcontentfilter_delete_rules_id'); + }); + + $this->group('/variables', function () { + /* @var $this Slim\App */ + $this->get('/{guid}', 'advancedcontentfilter_get_variables_guid'); + }); +}); diff --git a/advancedcontentfilter/templates/settings.tpl b/advancedcontentfilter/templates/settings.tpl index 8b82e595..c9dfbe3a 100644 --- a/advancedcontentfilter/templates/settings.tpl +++ b/advancedcontentfilter/templates/settings.tpl @@ -3,7 +3,7 @@
'); - } elseif ($format === self::FORMAT_JS) { - static::writeOutput(static::generateScript()); + static::writeOutput(''); + } else { // js format + static::writeOutput(self::generateScript()); } static::resetStatic(); } @@ -96,7 +91,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler self::resetStatic(); } - public function reset() + public function reset(): void { parent::reset(); @@ -174,18 +169,18 @@ class BrowserConsoleHandler extends AbstractProcessingHandler { $script = []; foreach (static::$records as $record) { - $context = static::dump('Context', $record['context']); - $extra = static::dump('Extra', $record['extra']); + $context = self::dump('Context', $record->context); + $extra = self::dump('Extra', $record->extra); - if (empty($context) && empty($extra)) { - $script[] = static::call_array(static::getConsoleMethodForLevel($record['level']), static::handleStyles($record['formatted'])); + if (\count($context) === 0 && \count($extra) === 0) { + $script[] = self::call_array('log', self::handleStyles($record->formatted)); } else { $script = array_merge( $script, - [static::call_array('groupCollapsed', static::handleStyles($record['formatted']))], + [self::call_array('groupCollapsed', self::handleStyles($record->formatted))], $context, $extra, - [static::call('groupEnd')] + [self::call('groupEnd')] ); } } @@ -193,20 +188,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; } - private static function getConsoleMethodForLevel(int $level): string - { - return [ - Logger::DEBUG => 'debug', - Logger::INFO => 'info', - Logger::NOTICE => 'info', - Logger::WARNING => 'warn', - Logger::ERROR => 'error', - Logger::CRITICAL => 'error', - Logger::ALERT => 'error', - Logger::EMERGENCY => 'error', - ][$level] ?? 'log'; - } - /** * @return string[] */ @@ -218,14 +199,14 @@ class BrowserConsoleHandler extends AbstractProcessingHandler foreach (array_reverse($matches) as $match) { $args[] = '"font-weight: normal"'; - $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); + $args[] = self::quote(self::handleCustomStyles($match[2][0], $match[1][0])); $pos = $match[0][1]; $format = Utils::substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . Utils::substr($format, $pos + strlen($match[0][0])); } - $args[] = static::quote('font-weight: normal'); - $args[] = static::quote($format); + $args[] = self::quote('font-weight: normal'); + $args[] = self::quote($format); return array_reverse($args); } @@ -251,6 +232,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler if (null === $style) { $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to run preg_replace_callback: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); } @@ -265,16 +247,16 @@ class BrowserConsoleHandler extends AbstractProcessingHandler { $script = []; $dict = array_filter($dict); - if (empty($dict)) { + if (\count($dict) === 0) { return $script; } - $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); + $script[] = self::call('log', self::quote('%c%s'), self::quote('font-weight: bold'), self::quote($title)); foreach ($dict as $key => $value) { $value = json_encode($value); if (empty($value)) { - $value = static::quote(''); + $value = self::quote(''); } - $script[] = static::call('log', static::quote('%s: %o'), static::quote((string) $key), $value); + $script[] = self::call('log', self::quote('%s: %o'), self::quote((string) $key), $value); } return $script; @@ -295,7 +277,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler throw new \UnexpectedValueException('Expected the first arg to be a string, got: '.var_export($method, true)); } - return static::call_array($method, $args); + return self::call_array($method, $args); } /** diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php index fcce5d63..ff89faa8 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php @@ -11,9 +11,10 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Buffers all records until closing the handler and then pass them as batch. @@ -22,32 +23,30 @@ use Monolog\Formatter\FormatterInterface; * sending one per log message. * * @author Christophe Coevoet - * - * @phpstan-import-type Record from \Monolog\Logger */ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; - /** @var HandlerInterface */ - protected $handler; - /** @var int */ - protected $bufferSize = 0; - /** @var int */ - protected $bufferLimit; - /** @var bool */ - protected $flushOnOverflow; - /** @var Record[] */ - protected $buffer = []; - /** @var bool */ - protected $initialized = false; + protected HandlerInterface $handler; + + protected int $bufferSize = 0; + + protected int $bufferLimit; + + protected bool $flushOnOverflow; + + /** @var LogRecord[] */ + protected array $buffer = []; + + protected bool $initialized = false; /** * @param HandlerInterface $handler Handler. * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded */ - public function __construct(HandlerInterface $handler, int $bufferLimit = 0, $level = Logger::DEBUG, bool $bubble = true, bool $flushOnOverflow = false) + public function __construct(HandlerInterface $handler, int $bufferLimit = 0, int|string|Level $level = Level::Debug, bool $bubble = true, bool $flushOnOverflow = false) { parent::__construct($level, $bubble); $this->handler = $handler; @@ -56,11 +55,11 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - if ($record['level'] < $this->level) { + if ($record->level->isLowerThan($this->level)) { return false; } @@ -79,8 +78,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } } - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } @@ -108,7 +106,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { @@ -126,7 +124,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa $this->buffer = []; } - public function reset() + public function reset(): void { $this->flush(); @@ -140,7 +138,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -154,7 +152,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php index 234ecf61..3742d47d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php @@ -13,8 +13,10 @@ namespace Monolog\Handler; use Monolog\Formatter\ChromePHPFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; +use Monolog\DateTimeImmutable; /** * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) @@ -22,8 +24,6 @@ use Monolog\Utils; * This also works out of the box with Firefox 43+ * * @author Christophe Coevoet - * - * @phpstan-import-type Record from \Monolog\Logger */ class ChromePHPHandler extends AbstractProcessingHandler { @@ -44,29 +44,25 @@ class ChromePHPHandler extends AbstractProcessingHandler */ protected const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; - /** @var bool */ - protected static $initialized = false; + protected static bool $initialized = false; /** * Tracks whether we sent too much data * * Chrome limits the headers to 4KB, so when we sent 3KB we stop sending - * - * @var bool */ - protected static $overflowed = false; + protected static bool $overflowed = false; /** @var mixed[] */ - protected static $json = [ + protected static array $json = [ 'version' => self::VERSION, 'columns' => ['label', 'log', 'backtrace', 'type'], 'rows' => [], ]; - /** @var bool */ - protected static $sendHeaders = true; + protected static bool $sendHeaders = true; - public function __construct($level = Logger::DEBUG, bool $bubble = true) + public function __construct(int|string|Level $level = Level::Debug, bool $bubble = true) { parent::__construct($level, $bubble); if (!function_exists('json_encode')) { @@ -75,7 +71,7 @@ class ChromePHPHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { @@ -86,15 +82,15 @@ class ChromePHPHandler extends AbstractProcessingHandler $messages = []; foreach ($records as $record) { - if ($record['level'] < $this->level) { + if ($record->level < $this->level) { continue; } - /** @var Record $message */ + $message = $this->processRecord($record); $messages[] = $message; } - if (!empty($messages)) { + if (\count($messages) > 0) { $messages = $this->getFormatter()->formatBatch($messages); self::$json['rows'] = array_merge(self::$json['rows'], $messages); $this->send(); @@ -102,7 +98,7 @@ class ChromePHPHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { @@ -115,13 +111,13 @@ class ChromePHPHandler extends AbstractProcessingHandler * @see sendHeader() * @see send() */ - protected function write(array $record): void + protected function write(LogRecord $record): void { if (!$this->isWebRequest()) { return; } - self::$json['rows'][] = $record['formatted']; + self::$json['rows'][] = $record->formatted; $this->send(); } @@ -153,15 +149,12 @@ class ChromePHPHandler extends AbstractProcessingHandler if (strlen($data) > 3 * 1024) { self::$overflowed = true; - $record = [ - 'message' => 'Incomplete logs, chrome header size limit reached', - 'context' => [], - 'level' => Logger::WARNING, - 'level_name' => Logger::getLevelName(Logger::WARNING), - 'channel' => 'monolog', - 'datetime' => new \DateTimeImmutable(), - 'extra' => [], - ]; + $record = new LogRecord( + message: 'Incomplete logs, chrome header size limit reached', + level: Level::Warning, + channel: 'monolog', + datetime: new DateTimeImmutable(true), + ); self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record); $json = Utils::jsonEncode(self::$json, Utils::DEFAULT_JSON_FLAGS & ~JSON_UNESCAPED_UNICODE, true); $data = base64_encode($json); @@ -187,7 +180,7 @@ class ChromePHPHandler extends AbstractProcessingHandler */ protected function headersAccepted(): bool { - if (empty($_SERVER['HTTP_USER_AGENT'])) { + if (!isset($_SERVER['HTTP_USER_AGENT'])) { return false; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php index 52657613..8d9c10e7 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php @@ -13,22 +13,42 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\JsonFormatter; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * CouchDB handler * * @author Markus Bachmann + * @phpstan-type Options array{ + * host: string, + * port: int, + * dbname: string, + * username: string|null, + * password: string|null + * } + * @phpstan-type InputOptions array{ + * host?: string, + * port?: int, + * dbname?: string, + * username?: string|null, + * password?: string|null + * } */ class CouchDBHandler extends AbstractProcessingHandler { - /** @var mixed[] */ - private $options; + /** + * @var mixed[] + * @phpstan-var Options + */ + private array $options; /** * @param mixed[] $options + * + * @phpstan-param InputOptions $options */ - public function __construct(array $options = [], $level = Logger::DEBUG, bool $bubble = true) + public function __construct(array $options = [], int|string|Level $level = Level::Debug, bool $bubble = true) { $this->options = array_merge([ 'host' => 'localhost', @@ -42,12 +62,12 @@ class CouchDBHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { $basicAuth = null; - if ($this->options['username']) { + if (null !== $this->options['username'] && null !== $this->options['password']) { $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); } @@ -55,7 +75,7 @@ class CouchDBHandler extends AbstractProcessingHandler $context = stream_context_create([ 'http' => [ 'method' => 'POST', - 'content' => $record['formatted'], + 'content' => $record->formatted, 'ignore_errors' => true, 'max_redirects' => 0, 'header' => 'Content-type: application/json', @@ -68,7 +88,7 @@ class CouchDBHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php index 3535a4fc..8388f5ad 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Logs to Cube. @@ -23,18 +24,13 @@ use Monolog\Utils; */ class CubeHandler extends AbstractProcessingHandler { - /** @var resource|\Socket|null */ - private $udpConnection = null; - /** @var resource|\CurlHandle|null */ - private $httpConnection = null; - /** @var string */ - private $scheme; - /** @var string */ - private $host; - /** @var int */ - private $port; + private ?\Socket $udpConnection = null; + private ?\CurlHandle $httpConnection = null; + private string $scheme; + private string $host; + private int $port; /** @var string[] */ - private $acceptedSchemes = ['http', 'udp']; + private array $acceptedSchemes = ['http', 'udp']; /** * Create a Cube handler @@ -43,7 +39,7 @@ class CubeHandler extends AbstractProcessingHandler * A valid url must consist of three parts : protocol://host:port * Only valid protocols used by Cube are http and udp */ - public function __construct(string $url, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(string $url, int|string|Level $level = Level::Debug, bool $bubble = true) { $urlInfo = parse_url($url); @@ -51,7 +47,7 @@ class CubeHandler extends AbstractProcessingHandler throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); } - if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { + if (!in_array($urlInfo['scheme'], $this->acceptedSchemes, true)) { throw new \UnexpectedValueException( 'Invalid protocol (' . $urlInfo['scheme'] . ').' . ' Valid options are ' . implode(', ', $this->acceptedSchemes) @@ -60,7 +56,7 @@ class CubeHandler extends AbstractProcessingHandler $this->scheme = $urlInfo['scheme']; $this->host = $urlInfo['host']; - $this->port = (int) $urlInfo['port']; + $this->port = $urlInfo['port']; parent::__construct($level, $bubble); } @@ -111,24 +107,24 @@ class CubeHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $date = $record['datetime']; + $date = $record->datetime; $data = ['time' => $date->format('Y-m-d\TH:i:s.uO')]; - unset($record['datetime']); + $context = $record->context; - if (isset($record['context']['type'])) { - $data['type'] = $record['context']['type']; - unset($record['context']['type']); + if (isset($context['type'])) { + $data['type'] = $context['type']; + unset($context['type']); } else { - $data['type'] = $record['channel']; + $data['type'] = $record->channel; } - $data['data'] = $record['context']; - $data['data']['level'] = $record['level']; + $data['data'] = $context; + $data['data']['level'] = $record->level; if ($this->scheme === 'http') { $this->writeHttp(Utils::jsonEncode($data)); @@ -139,16 +135,20 @@ class CubeHandler extends AbstractProcessingHandler private function writeUdp(string $data): void { - if (!$this->udpConnection) { + if (null === $this->udpConnection) { $this->connectUdp(); } + if (null === $this->udpConnection) { + throw new \LogicException('No UDP socket could be opened'); + } + socket_send($this->udpConnection, $data, strlen($data), 0); } private function writeHttp(string $data): void { - if (!$this->httpConnection) { + if (null === $this->httpConnection) { $this->connectHttp(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php index 7213e8ee..4decf0e6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php @@ -21,7 +21,7 @@ use CurlHandle; final class Util { /** @var array */ - private static $retriableErrorCodes = [ + private static array $retriableErrorCodes = [ CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT, CURLE_HTTP_NOT_FOUND, @@ -34,19 +34,17 @@ final class Util /** * Executes a CURL request with optional retries and exception on failure * - * @param resource|CurlHandle $ch curl handler - * @param int $retries - * @param bool $closeAfterDone - * @return bool|string @see curl_exec + * @param CurlHandle $ch curl handler + * @return bool|string @see curl_exec */ - public static function execute($ch, int $retries = 5, bool $closeAfterDone = true) + public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfterDone = true) { while ($retries--) { $curlResponse = curl_exec($ch); if ($curlResponse === false) { $curlErrno = curl_errno($ch); - if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { + if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || $retries === 0) { $curlError = curl_error($ch); if ($closeAfterDone) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php index 9b85ae7e..35549121 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php @@ -11,8 +11,10 @@ namespace Monolog\Handler; +use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Simple handler wrapper that deduplicates log records across multiple requests @@ -33,45 +35,29 @@ use Psr\Log\LogLevel; * same way. * * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger */ class DeduplicationHandler extends BufferHandler { - /** - * @var string - */ - protected $deduplicationStore; + protected string $deduplicationStore; + + protected Level $deduplicationLevel; + + protected int $time; + + private bool $gc = false; /** - * @var Level - */ - protected $deduplicationLevel; - - /** - * @var int - */ - protected $time; - - /** - * @var bool - */ - private $gc = false; - - /** - * @param HandlerInterface $handler Handler. - * @param string $deduplicationStore The file/path where the deduplication log should be kept - * @param string|int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes - * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param HandlerInterface $handler Handler. + * @param string $deduplicationStore The file/path where the deduplication log should be kept + * @param int|string|Level|LogLevel::* $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes + * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * - * @phpstan-param Level|LevelName|LogLevel::* $deduplicationLevel + * @phpstan-param value-of|value-of|Level|LogLevel::* $deduplicationLevel */ - public function __construct(HandlerInterface $handler, ?string $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, int $time = 60, bool $bubble = true) + public function __construct(HandlerInterface $handler, ?string $deduplicationStore = null, int|string|Level $deduplicationLevel = Level::Error, int $time = 60, bool $bubble = true) { - parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); + parent::__construct($handler, 0, Level::Debug, $bubble, false); $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); @@ -87,8 +73,8 @@ class DeduplicationHandler extends BufferHandler $passthru = null; foreach ($this->buffer as $record) { - if ($record['level'] >= $this->deduplicationLevel) { - $passthru = $passthru || !$this->isDuplicate($record); + if ($record->level->value >= $this->deduplicationLevel->value) { + $passthru = $passthru === true || !$this->isDuplicate($record); if ($passthru) { $this->appendRecord($record); } @@ -107,10 +93,7 @@ class DeduplicationHandler extends BufferHandler } } - /** - * @phpstan-param Record $record - */ - private function isDuplicate(array $record): bool + private function isDuplicate(LogRecord $record): bool { if (!file_exists($this->deduplicationStore)) { return false; @@ -122,13 +105,13 @@ class DeduplicationHandler extends BufferHandler } $yesterday = time() - 86400; - $timestampValidity = $record['datetime']->getTimestamp() - $this->time; - $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); + $timestampValidity = $record->datetime->getTimestamp() - $this->time; + $expectedMessage = preg_replace('{[\r\n].*}', '', $record->message); for ($i = count($store) - 1; $i >= 0; $i--) { list($timestamp, $level, $message) = explode(':', $store[$i], 3); - if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { + if ($level === $record->level->getName() && $message === $expectedMessage && $timestamp > $timestampValidity) { return true; } @@ -148,7 +131,7 @@ class DeduplicationHandler extends BufferHandler $handle = fopen($this->deduplicationStore, 'rw+'); - if (!$handle) { + if (false === $handle) { throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore); } @@ -159,7 +142,7 @@ class DeduplicationHandler extends BufferHandler while (!feof($handle)) { $log = fgets($handle); - if ($log && substr($log, 0, 10) >= $timestampValidity) { + if (is_string($log) && '' !== $log && substr($log, 0, 10) >= $timestampValidity) { $validLogs[] = $log; } } @@ -176,11 +159,8 @@ class DeduplicationHandler extends BufferHandler $this->gc = false; } - /** - * @phpstan-param Record $record - */ - private function appendRecord(array $record): void + private function appendRecord(LogRecord $record): void { - file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); + file_put_contents($this->deduplicationStore, $record->datetime->getTimestamp() . ':' . $record->level->getName() . ':' . preg_replace('{[\r\n].*}', '', $record->message) . "\n", FILE_APPEND); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php index ebd52c3a..eab9f108 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php @@ -11,10 +11,11 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; use Doctrine\CouchDB\CouchDBClient; +use Monolog\LogRecord; /** * CouchDB handler for Doctrine CouchDB ODM @@ -23,21 +24,20 @@ use Doctrine\CouchDB\CouchDBClient; */ class DoctrineCouchDBHandler extends AbstractProcessingHandler { - /** @var CouchDBClient */ - private $client; + private CouchDBClient $client; - public function __construct(CouchDBClient $client, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(CouchDBClient $client, int|string|Level $level = Level::Debug, bool $bubble = true) { $this->client = $client; parent::__construct($level, $bubble); } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->client->postDocument($record['formatted']); + $this->client->postDocument($record->formatted); } protected function getDefaultFormatter(): FormatterInterface diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php index 21840bf6..f1c5a959 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php @@ -16,7 +16,8 @@ use Aws\DynamoDb\DynamoDbClient; use Monolog\Formatter\FormatterInterface; use Aws\DynamoDb\Marshaler; use Monolog\Formatter\ScalarFormatter; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) @@ -28,35 +29,15 @@ class DynamoDbHandler extends AbstractProcessingHandler { public const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; - /** - * @var DynamoDbClient - */ - protected $client; + protected DynamoDbClient $client; - /** - * @var string - */ - protected $table; + protected string $table; - /** - * @var int - */ - protected $version; + protected Marshaler $marshaler; - /** - * @var Marshaler - */ - protected $marshaler; - - public function __construct(DynamoDbClient $client, string $table, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(DynamoDbClient $client, string $table, int|string|Level $level = Level::Debug, bool $bubble = true) { - /** @phpstan-ignore-next-line */ - if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { - $this->version = 3; - $this->marshaler = new Marshaler; - } else { - $this->version = 2; - } + $this->marshaler = new Marshaler; $this->client = $client; $this->table = $table; @@ -65,17 +46,12 @@ class DynamoDbHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $filtered = $this->filterEmptyFields($record['formatted']); - if ($this->version === 3) { - $formatted = $this->marshaler->marshalItem($filtered); - } else { - /** @phpstan-ignore-next-line */ - $formatted = $this->client->formatAttributes($filtered); - } + $filtered = $this->filterEmptyFields($record->formatted); + $formatted = $this->marshaler->marshalItem($filtered); $this->client->putItem([ 'TableName' => $this->table, @@ -90,12 +66,12 @@ class DynamoDbHandler extends AbstractProcessingHandler protected function filterEmptyFields(array $record): array { return array_filter($record, function ($value) { - return !empty($value) || false === $value || 0 === $value; + return [] !== $value; }); } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php index fc92ca42..d9b85b4d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php @@ -14,9 +14,10 @@ namespace Monolog\Handler; use Elastica\Document; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\ElasticaFormatter; -use Monolog\Logger; +use Monolog\Level; use Elastica\Client; use Elastica\Exception\ExceptionInterface; +use Monolog\LogRecord; /** * Elastic Search handler @@ -33,24 +34,34 @@ use Elastica\Exception\ExceptionInterface; * $log->pushHandler($handler); * * @author Jelle Vink + * @phpstan-type Options array{ + * index: string, + * type: string, + * ignore_error: bool + * } + * @phpstan-type InputOptions array{ + * index?: string, + * type?: string, + * ignore_error?: bool + * } */ class ElasticaHandler extends AbstractProcessingHandler { - /** - * @var Client - */ - protected $client; + protected Client $client; /** * @var mixed[] Handler config options + * @phpstan-var Options */ - protected $options = []; + protected array $options; /** * @param Client $client Elastica Client object * @param mixed[] $options Handler configuration + * + * @phpstan-param InputOptions $options */ - public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true) + public function __construct(Client $client, array $options = [], int|string|Level $level = Level::Debug, bool $bubble = true) { parent::__construct($level, $bubble); $this->client = $client; @@ -65,15 +76,15 @@ class ElasticaHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->bulkSend([$record['formatted']]); + $this->bulkSend([$record->formatted]); } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -86,6 +97,8 @@ class ElasticaHandler extends AbstractProcessingHandler /** * @return mixed[] + * + * @phpstan-return Options */ public function getOptions(): array { @@ -93,7 +106,7 @@ class ElasticaHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { @@ -101,7 +114,7 @@ class ElasticaHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php index e88375c0..c288824a 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php @@ -14,12 +14,13 @@ namespace Monolog\Handler; use Elastic\Elasticsearch\Response\Elasticsearch; use Throwable; use RuntimeException; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\ElasticsearchFormatter; use InvalidArgumentException; use Elasticsearch\Common\Exceptions\RuntimeException as ElasticsearchRuntimeException; use Elasticsearch\Client; +use Monolog\LogRecord; use Elastic\Elasticsearch\Exception\InvalidArgumentException as ElasticInvalidArgumentException; use Elastic\Elasticsearch\Client as Client8; @@ -43,18 +44,26 @@ use Elastic\Elasticsearch\Client as Client8; * $log->pushHandler($handler); * * @author Avtandil Kikabidze + * @phpstan-type Options array{ + * index: string, + * type: string, + * ignore_error: bool + * } + * @phpstan-type InputOptions array{ + * index?: string, + * type?: string, + * ignore_error?: bool + * } */ class ElasticsearchHandler extends AbstractProcessingHandler { - /** - * @var Client|Client8 - */ - protected $client; + protected Client|Client8 $client; /** * @var mixed[] Handler config options + * @phpstan-var Options */ - protected $options = []; + protected array $options; /** * @var bool @@ -64,13 +73,11 @@ class ElasticsearchHandler extends AbstractProcessingHandler /** * @param Client|Client8 $client Elasticsearch Client object * @param mixed[] $options Handler configuration + * + * @phpstan-param InputOptions $options */ - public function __construct($client, array $options = [], $level = Logger::DEBUG, bool $bubble = true) + public function __construct(Client|Client8 $client, array $options = [], int|string|Level $level = Level::Debug, bool $bubble = true) { - if (!$client instanceof Client && !$client instanceof Client8) { - throw new \TypeError('Elasticsearch\Client or Elastic\Elasticsearch\Client instance required'); - } - parent::__construct($level, $bubble); $this->client = $client; $this->options = array_merge( @@ -92,15 +99,15 @@ class ElasticsearchHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->bulkSend([$record['formatted']]); + $this->bulkSend([$record->formatted]); } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -115,6 +122,8 @@ class ElasticsearchHandler extends AbstractProcessingHandler * Getter options * * @return mixed[] + * + * @phpstan-return Options */ public function getOptions(): array { @@ -122,7 +131,7 @@ class ElasticsearchHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { @@ -130,7 +139,7 @@ class ElasticsearchHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { @@ -141,7 +150,7 @@ class ElasticsearchHandler extends AbstractProcessingHandler /** * Use Elasticsearch bulk API to send list of documents * - * @param array[] $records Records + _index/_type keys + * @param array> $records Records + _index/_type keys * @throws \RuntimeException */ protected function bulkSend(array $records): void diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php index f2e22036..477d7e45 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php @@ -13,8 +13,9 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Stores to PHP error_log() handler. @@ -26,16 +27,14 @@ class ErrorLogHandler extends AbstractProcessingHandler public const OPERATING_SYSTEM = 0; public const SAPI = 4; - /** @var int */ - protected $messageType; - /** @var bool */ - protected $expandNewlines; + protected int $messageType; + protected bool $expandNewlines; /** * @param int $messageType Says where the error should go. * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries */ - public function __construct(int $messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, bool $bubble = true, bool $expandNewlines = false) + public function __construct(int $messageType = self::OPERATING_SYSTEM, int|string|Level $level = Level::Debug, bool $bubble = true, bool $expandNewlines = false) { parent::__construct($level, $bubble); @@ -61,7 +60,7 @@ class ErrorLogHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { @@ -69,19 +68,20 @@ class ErrorLogHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { if (!$this->expandNewlines) { - error_log((string) $record['formatted'], $this->messageType); + error_log((string) $record->formatted, $this->messageType); return; } - $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); + $lines = preg_split('{[\r\n]+}', (string) $record->formatted); if ($lines === false) { $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / '. Utils::pcreLastErrorMessage($pcreErrorCode)); } foreach ($lines as $line) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php index d4e234ce..1776eb51 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php @@ -12,6 +12,7 @@ namespace Monolog\Handler; use Throwable; +use Monolog\LogRecord; /** * Forwards records to at most one handler @@ -19,18 +20,15 @@ use Throwable; * If a handler fails, the exception is suppressed and the record is forwarded to the next handler. * * As soon as one handler handles a record successfully, the handling stops there. - * - * @phpstan-import-type Record from \Monolog\Logger */ class FallbackGroupHandler extends GroupHandler { /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } foreach ($this->handlers as $handler) { @@ -46,16 +44,15 @@ class FallbackGroupHandler extends GroupHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { - if ($this->processors) { + if (\count($this->processors) > 0) { $processed = []; foreach ($records as $record) { $processed[] = $this->processRecord($record); } - /** @var Record[] $records */ $records = $processed; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php index 718f17ef..00381ab4 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php @@ -11,10 +11,13 @@ namespace Monolog\Handler; +use Closure; +use Monolog\Level; use Monolog\Logger; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Simple handler wrapper that filters records based on a list of levels @@ -23,110 +26,99 @@ use Psr\Log\LogLevel; * * @author Hennadiy Verkh * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class FilterHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** - * Handler or factory callable($record, $this) + * Handler or factory Closure($record, $this) * - * @var callable|HandlerInterface - * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface + * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface */ - protected $handler; + protected Closure|HandlerInterface $handler; /** * Minimum level for logs that are passed to handler * - * @var int[] - * @phpstan-var array + * @var bool[] Map of Level value => true + * @phpstan-var array, true> */ - protected $acceptedLevels; + protected array $acceptedLevels; /** * Whether the messages that are handled can bubble up the stack or not - * - * @var bool */ - protected $bubble; + protected bool $bubble; /** - * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler + * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler * - * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $filterHandler). - * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided - * @param int|string $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $filterHandler). + * @param int|string|Level|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided + * @param int|string|Level|LogLevel::* $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * - * @phpstan-param Level|LevelName|LogLevel::*|array $minLevelOrList - * @phpstan-param Level|LevelName|LogLevel::* $maxLevel + * @phpstan-param value-of|value-of|Level|LogLevel::*|array|value-of|Level|LogLevel::*> $minLevelOrList + * @phpstan-param value-of|value-of|Level|LogLevel::* $maxLevel */ - public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, bool $bubble = true) + public function __construct(Closure|HandlerInterface $handler, int|string|Level|array $minLevelOrList = Level::Debug, int|string|Level $maxLevel = Level::Emergency, bool $bubble = true) { $this->handler = $handler; $this->bubble = $bubble; $this->setAcceptedLevels($minLevelOrList, $maxLevel); - - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); - } } /** - * @phpstan-return array + * @phpstan-return list List of levels */ public function getAcceptedLevels(): array { - return array_flip($this->acceptedLevels); + return array_map(fn (int $level) => Level::from($level), array_keys($this->acceptedLevels)); } /** - * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided - * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array + * @param int|string|Level|LogLevel::*|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided + * @param int|string|Level|LogLevel::* $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array * - * @phpstan-param Level|LevelName|LogLevel::*|array $minLevelOrList - * @phpstan-param Level|LevelName|LogLevel::* $maxLevel + * @phpstan-param value-of|value-of|Level|LogLevel::*|array|value-of|Level|LogLevel::*> $minLevelOrList + * @phpstan-param value-of|value-of|Level|LogLevel::* $maxLevel */ - public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY): self + public function setAcceptedLevels(int|string|Level|array $minLevelOrList = Level::Debug, int|string|Level $maxLevel = Level::Emergency): self { if (is_array($minLevelOrList)) { - $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList); + $acceptedLevels = array_map(Logger::toMonologLevel(...), $minLevelOrList); } else { $minLevelOrList = Logger::toMonologLevel($minLevelOrList); $maxLevel = Logger::toMonologLevel($maxLevel); - $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) { - return $level >= $minLevelOrList && $level <= $maxLevel; - })); + $acceptedLevels = array_values(array_filter(Level::cases(), fn (Level $level) => $level->value >= $minLevelOrList->value && $level->value <= $maxLevel->value)); + } + $this->acceptedLevels = []; + foreach ($acceptedLevels as $level) { + $this->acceptedLevels[$level->value] = true; } - $this->acceptedLevels = array_flip($acceptedLevels); return $this; } /** - * {@inheritDoc} + * @inheritDoc */ - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { - return isset($this->acceptedLevels[$record['level']]); + return isset($this->acceptedLevels[$record->level->value]); } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { if (!$this->isHandling($record)) { return false; } - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } @@ -136,7 +128,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { @@ -155,26 +147,23 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese /** * Return the nested handler * - * If the handler was provided as a factory callable, this will trigger the handler's instantiation. - * - * @return HandlerInterface - * - * @phpstan-param Record $record + * If the handler was provided as a factory, this will trigger the handler's instantiation. */ - public function getHandler(array $record = null) + public function getHandler(LogRecord $record = null): HandlerInterface { if (!$this->handler instanceof HandlerInterface) { - $this->handler = ($this->handler)($record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); + $handler = ($this->handler)($record, $this); + if (!$handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory Closure should return a HandlerInterface"); } + $this->handler = $handler; } return $this->handler; } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -189,7 +178,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { @@ -201,7 +190,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); } - public function reset() + public function reset(): void { $this->resetProcessors(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php index 0aa5607b..e8a1b0b0 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php @@ -11,19 +11,17 @@ namespace Monolog\Handler\FingersCrossed; +use Monolog\LogRecord; + /** * Interface for activation strategies for the FingersCrossedHandler. * * @author Johannes M. Schmitt - * - * @phpstan-import-type Record from \Monolog\Logger */ interface ActivationStrategyInterface { /** * Returns whether the given record activates the handler. - * - * @phpstan-param Record $record */ - public function isHandlerActivated(array $record): bool; + public function isHandlerActivated(LogRecord $record): bool; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php index 7b9abb58..383e19af 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php @@ -11,8 +11,10 @@ namespace Monolog\Handler\FingersCrossed; +use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Channel and Error level based monolog activation strategy. Allows to trigger activation @@ -23,55 +25,45 @@ use Psr\Log\LogLevel; * * * $activationStrategy = new ChannelLevelActivationStrategy( - * Logger::CRITICAL, + * Level::Critical, * array( - * 'request' => Logger::ALERT, - * 'sensitive' => Logger::ERROR, + * 'request' => Level::Alert, + * 'sensitive' => Level::Error, * ) * ); * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); * * * @author Mike Meessen - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class ChannelLevelActivationStrategy implements ActivationStrategyInterface { - /** - * @var Level - */ - private $defaultActionLevel; + private Level $defaultActionLevel; /** * @var array */ - private $channelToActionLevel; + private array $channelToActionLevel; /** - * @param int|string $defaultActionLevel The default action level to be used if the record's category doesn't match any - * @param array $channelToActionLevel An array that maps channel names to action levels. + * @param int|string|Level|LogLevel::* $defaultActionLevel The default action level to be used if the record's category doesn't match any + * @param array $channelToActionLevel An array that maps channel names to action levels. * - * @phpstan-param array $channelToActionLevel - * @phpstan-param Level|LevelName|LogLevel::* $defaultActionLevel + * @phpstan-param value-of|value-of|Level|LogLevel::* $defaultActionLevel + * @phpstan-param array|value-of|Level|LogLevel::*> $channelToActionLevel */ - public function __construct($defaultActionLevel, array $channelToActionLevel = []) + public function __construct(int|string|Level $defaultActionLevel, array $channelToActionLevel = []) { $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); - $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); + $this->channelToActionLevel = array_map(Logger::toMonologLevel(...), $channelToActionLevel); } - /** - * @phpstan-param Record $record - */ - public function isHandlerActivated(array $record): bool + public function isHandlerActivated(LogRecord $record): bool { - if (isset($this->channelToActionLevel[$record['channel']])) { - return $record['level'] >= $this->channelToActionLevel[$record['channel']]; + if (isset($this->channelToActionLevel[$record->channel])) { + return $record->level->value >= $this->channelToActionLevel[$record->channel]->value; } - return $record['level'] >= $this->defaultActionLevel; + return $record->level->value >= $this->defaultActionLevel->value; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php index 5ec88eab..c3ca2967 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php @@ -11,6 +11,8 @@ namespace Monolog\Handler\FingersCrossed; +use Monolog\Level; +use Monolog\LogRecord; use Monolog\Logger; use Psr\Log\LogLevel; @@ -18,29 +20,23 @@ use Psr\Log\LogLevel; * Error level based activation strategy. * * @author Johannes M. Schmitt - * - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class ErrorLevelActivationStrategy implements ActivationStrategyInterface { - /** - * @var Level - */ - private $actionLevel; + private Level $actionLevel; /** - * @param int|string $actionLevel Level or name or value + * @param int|string|Level $actionLevel Level or name or value * - * @phpstan-param Level|LevelName|LogLevel::* $actionLevel + * @phpstan-param value-of|value-of|Level|LogLevel::* $actionLevel */ - public function __construct($actionLevel) + public function __construct(int|string|Level $actionLevel) { $this->actionLevel = Logger::toMonologLevel($actionLevel); } - public function isHandlerActivated(array $record): bool + public function isHandlerActivated(LogRecord $record): bool { - return $record['level'] >= $this->actionLevel; + return $record->level->value >= $this->actionLevel->value; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php index 0627b445..ce2a3a8e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php @@ -11,12 +11,15 @@ namespace Monolog\Handler; +use Closure; use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; +use Monolog\Level; use Monolog\Logger; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Buffers all records until a certain level is reached @@ -33,55 +36,50 @@ use Psr\Log\LogLevel; * Monolog\Handler\FingersCrossed\ namespace. * * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** - * @var callable|HandlerInterface - * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface + * Handler or factory Closure($record, $this) + * + * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface */ - protected $handler; - /** @var ActivationStrategyInterface */ - protected $activationStrategy; - /** @var bool */ - protected $buffering = true; - /** @var int */ - protected $bufferSize; - /** @var Record[] */ - protected $buffer = []; - /** @var bool */ - protected $stopBuffering; - /** - * @var ?int - * @phpstan-var ?Level - */ - protected $passthruLevel; - /** @var bool */ - protected $bubble; + protected Closure|HandlerInterface $handler; + + protected ActivationStrategyInterface $activationStrategy; + + protected bool $buffering = true; + + protected int $bufferSize; + + /** @var LogRecord[] */ + protected array $buffer = []; + + protected bool $stopBuffering; + + protected Level|null $passthruLevel = null; + + protected bool $bubble; /** - * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler + * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler * - * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler). - * @param int|string|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated - * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) - * @param int|string $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered + * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $fingersCrossedHandler). + * @param int|string|Level|LogLevel::* $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated + * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) + * @param int|string|Level|LogLevel::*|null $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered * - * @phpstan-param Level|LevelName|LogLevel::* $passthruLevel - * @phpstan-param Level|LevelName|LogLevel::*|ActivationStrategyInterface $activationStrategy + * @phpstan-param value-of|value-of|Level|LogLevel::*|ActivationStrategyInterface $activationStrategy + * @phpstan-param value-of|value-of|Level|LogLevel::* $passthruLevel */ - public function __construct($handler, $activationStrategy = null, int $bufferSize = 0, bool $bubble = true, bool $stopBuffering = true, $passthruLevel = null) + public function __construct(Closure|HandlerInterface $handler, int|string|Level|ActivationStrategyInterface $activationStrategy = null, int $bufferSize = 0, bool $bubble = true, bool $stopBuffering = true, int|string|Level|null $passthruLevel = null) { if (null === $activationStrategy) { - $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING); + $activationStrategy = new ErrorLevelActivationStrategy(Level::Warning); } // convert simple int activationStrategy to an object @@ -98,16 +96,12 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa if ($passthruLevel !== null) { $this->passthruLevel = Logger::toMonologLevel($passthruLevel); } - - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); - } } /** - * {@inheritDoc} + * @inheritDoc */ - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { return true; } @@ -126,12 +120,11 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } @@ -151,7 +144,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { @@ -160,7 +153,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa $this->getHandler()->close(); } - public function reset() + public function reset(): void { $this->flushBuffer(); @@ -190,7 +183,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa if (null !== $this->passthruLevel) { $level = $this->passthruLevel; $this->buffer = array_filter($this->buffer, function ($record) use ($level) { - return $record['level'] >= $level; + return $record->level >= $level; }); if (count($this->buffer) > 0) { $this->getHandler(end($this->buffer))->handleBatch($this->buffer); @@ -204,26 +197,23 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa /** * Return the nested handler * - * If the handler was provided as a factory callable, this will trigger the handler's instantiation. - * - * @return HandlerInterface - * - * @phpstan-param Record $record + * If the handler was provided as a factory, this will trigger the handler's instantiation. */ - public function getHandler(array $record = null) + public function getHandler(LogRecord $record = null): HandlerInterface { if (!$this->handler instanceof HandlerInterface) { - $this->handler = ($this->handler)($record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); + $handler = ($this->handler)($record, $this); + if (!$handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory Closure should return a HandlerInterface"); } + $this->handler = $handler; } return $this->handler; } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -238,7 +228,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php index 72718de6..6b9e5103 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php @@ -13,13 +13,12 @@ namespace Monolog\Handler; use Monolog\Formatter\WildfireFormatter; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. * * @author Eric Clemmons (@ericclemmons) - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class FirePHPHandler extends AbstractProcessingHandler { @@ -47,18 +46,15 @@ class FirePHPHandler extends AbstractProcessingHandler /** * Whether or not Wildfire vendor-specific headers have been generated & sent yet - * @var bool */ - protected static $initialized = false; + protected static bool $initialized = false; /** * Shared static message index between potentially multiple handlers - * @var int */ - protected static $messageIndex = 1; + protected static int $messageIndex = 1; - /** @var bool */ - protected static $sendHeaders = true; + protected static bool $sendHeaders = true; /** * Base header creation function used by init headers & record headers @@ -85,21 +81,19 @@ class FirePHPHandler extends AbstractProcessingHandler * @phpstan-return non-empty-array * * @see createHeader() - * - * @phpstan-param FormattedRecord $record */ - protected function createRecordHeader(array $record): array + protected function createRecordHeader(LogRecord $record): array { // Wildfire is extensible to support multiple protocols & plugins in a single request, // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake. return $this->createHeader( [1, 1, 1, self::$messageIndex++], - $record['formatted'] + $record->formatted ); } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { @@ -140,7 +134,7 @@ class FirePHPHandler extends AbstractProcessingHandler * @see sendHeader() * @see sendInitHeaders() */ - protected function write(array $record): void + protected function write(LogRecord $record): void { if (!self::$sendHeaders || !$this->isWebRequest()) { return; @@ -171,7 +165,7 @@ class FirePHPHandler extends AbstractProcessingHandler */ protected function headersAccepted(): bool { - if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { + if (isset($_SERVER['HTTP_USER_AGENT']) && 1 === preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { return true; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php index 85c95b9d..9f44ba71 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php @@ -13,7 +13,8 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * Sends logs to Fleep.io using Webhook integrations @@ -22,8 +23,6 @@ use Monolog\Logger; * * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation * @author Ando Roots - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class FleepHookHandler extends SocketHandler { @@ -34,7 +33,7 @@ class FleepHookHandler extends SocketHandler /** * @var string Webhook token (specifies the conversation where logs are sent) */ - protected $token; + protected string $token; /** * Construct a new Fleep.io Handler. @@ -42,12 +41,12 @@ class FleepHookHandler extends SocketHandler * For instructions on how to create a new web hook in your conversations * see https://fleep.io/integrations/webhooks/ * - * @param string $token Webhook token + * @param string $token Webhook token * @throws MissingExtensionException */ public function __construct( string $token, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -89,16 +88,16 @@ class FleepHookHandler extends SocketHandler /** * Handles a log record */ - public function write(array $record): void + public function write(LogRecord $record): void { parent::write($record); $this->closeSocket(); } /** - * {@inheritDoc} + * @inheritDoc */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { $content = $this->buildContent($record); @@ -121,13 +120,11 @@ class FleepHookHandler extends SocketHandler /** * Builds the body of API call - * - * @phpstan-param FormattedRecord $record */ - private function buildContent(array $record): string + private function buildContent(LogRecord $record): string { $dataArray = [ - 'message' => $record['formatted'], + 'message' => $record->formatted, ]; return http_build_query($dataArray); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php index 5715d580..13581548 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php @@ -11,10 +11,11 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; use Monolog\Formatter\FlowdockFormatter; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Sends notifications through the Flowdock push API @@ -26,23 +27,17 @@ use Monolog\Formatter\FormatterInterface; * * @author Dominik Liebler * @see https://www.flowdock.com/api/push - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler - * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 */ class FlowdockHandler extends SocketHandler { - /** - * @var string - */ - protected $apiToken; + protected string $apiToken; /** * @throws MissingExtensionException if OpenSSL is missing */ public function __construct( string $apiToken, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -68,7 +63,7 @@ class FlowdockHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -88,9 +83,9 @@ class FlowdockHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { parent::write($record); @@ -98,9 +93,9 @@ class FlowdockHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { $content = $this->buildContent($record); @@ -109,12 +104,10 @@ class FlowdockHandler extends SocketHandler /** * Builds the body of API call - * - * @phpstan-param FormattedRecord $record */ - private function buildContent(array $record): string + private function buildContent(LogRecord $record): string { - return Utils::jsonEncode($record['formatted']['flowdock']); + return Utils::jsonEncode($record->formatted); } /** diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php index fc1693cd..72da59e1 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php @@ -23,15 +23,12 @@ interface FormattableHandlerInterface /** * Sets the formatter. * - * @param FormatterInterface $formatter - * @return HandlerInterface self + * @return HandlerInterface self */ public function setFormatter(FormatterInterface $formatter): HandlerInterface; /** * Gets the formatter. - * - * @return FormatterInterface */ public function getFormatter(): FormatterInterface; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php index b60bdce0..c044e078 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php @@ -21,13 +21,10 @@ use Monolog\Formatter\LineFormatter; */ trait FormattableHandlerTrait { - /** - * @var ?FormatterInterface - */ - protected $formatter; + protected FormatterInterface|null $formatter = null; /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -37,11 +34,11 @@ trait FormattableHandlerTrait } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { - if (!$this->formatter) { + if (null === $this->formatter) { $this->formatter = $this->getDefaultFormatter(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php index 4ff26c4c..ba5bb975 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php @@ -12,9 +12,10 @@ namespace Monolog\Handler; use Gelf\PublisherInterface; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\GelfMessageFormatter; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Handler to send messages to a Graylog2 (http://www.graylog2.org) server @@ -27,12 +28,12 @@ class GelfHandler extends AbstractProcessingHandler /** * @var PublisherInterface the publisher object that sends the message to the server */ - protected $publisher; + protected PublisherInterface $publisher; /** * @param PublisherInterface $publisher a gelf publisher object */ - public function __construct(PublisherInterface $publisher, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(PublisherInterface $publisher, int|string|Level $level = Level::Debug, bool $bubble = true) { parent::__construct($level, $bubble); @@ -40,15 +41,15 @@ class GelfHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->publisher->publish($record['formatted']); + $this->publisher->publish($record->formatted); } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php index 3c9dc4b3..7ab8bd97 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php @@ -13,22 +13,20 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\ResettableInterface; +use Monolog\LogRecord; /** * Forwards records to multiple handlers * * @author Lenar Lõhmus - * - * @phpstan-import-type Record from \Monolog\Logger */ class GroupHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface { use ProcessableHandlerTrait; /** @var HandlerInterface[] */ - protected $handlers; - /** @var bool */ - protected $bubble; + protected array $handlers; + protected bool $bubble; /** * @param HandlerInterface[] $handlers Array of Handlers. @@ -47,9 +45,9 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * {@inheritDoc} + * @inheritDoc */ - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { foreach ($this->handlers as $handler) { if ($handler->isHandling($record)) { @@ -61,12 +59,11 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } @@ -78,16 +75,15 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { - if ($this->processors) { + if (\count($this->processors) > 0) { $processed = []; foreach ($records as $record) { $processed[] = $this->processRecord($record); } - /** @var Record[] $records */ $records = $processed; } @@ -96,7 +92,7 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } } - public function reset() + public function reset(): void { $this->resetProcessors(); @@ -117,7 +113,7 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php index 34b4935d..e89f969b 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php @@ -19,7 +19,7 @@ namespace Monolog\Handler; abstract class Handler implements HandlerInterface { /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { @@ -29,7 +29,7 @@ abstract class Handler implements HandlerInterface } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php index affcc51f..83905c32 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php @@ -11,13 +11,12 @@ namespace Monolog\Handler; +use Monolog\LogRecord; + /** * Interface that all Monolog Handlers must implement * * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger */ interface HandlerInterface { @@ -30,13 +29,9 @@ interface HandlerInterface * is no guarantee that handle() will not be called, and isHandling() might not be called * for a given record. * - * @param array $record Partial log record containing only a level key - * - * @return bool - * - * @phpstan-param array{level: Level} $record + * @param LogRecord $record Partial log record having only a level initialized */ - public function isHandling(array $record): bool; + public function isHandling(LogRecord $record): bool; /** * Handles a record. @@ -48,20 +43,16 @@ interface HandlerInterface * Unless the bubbling is interrupted (by returning true), the Logger class will keep on * calling further handlers in the stack with a given log record. * - * @param array $record The record to handle - * @return bool true means that this handler handled the record, and that bubbling is not permitted. - * false means the record was either not processed or that this handler allows bubbling. - * - * @phpstan-param Record $record + * @param LogRecord $record The record to handle + * @return bool true means that this handler handled the record, and that bubbling is not permitted. + * false means the record was either not processed or that this handler allows bubbling. */ - public function handle(array $record): bool; + public function handle(LogRecord $record): bool; /** * Handles a set of records at once. * - * @param array $records The records to handle (an array of record arrays) - * - * @phpstan-param Record[] $records + * @param array $records The records to handle */ public function handleBatch(array $records): void; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php index d4351b9f..541ec254 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php @@ -13,6 +13,7 @@ namespace Monolog\Handler; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * This simple wrapper class can be used to extend handlers functionality. @@ -21,7 +22,7 @@ use Monolog\Formatter\FormatterInterface; * * Inherit from this class and override handle() like this: * - * public function handle(array $record) + * public function handle(LogRecord $record) * { * if ($record meets certain conditions) { * return false; @@ -33,10 +34,7 @@ use Monolog\Formatter\FormatterInterface; */ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, FormattableHandlerInterface, ResettableInterface { - /** - * @var HandlerInterface - */ - protected $handler; + protected HandlerInterface $handler; public function __construct(HandlerInterface $handler) { @@ -44,23 +42,23 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * {@inheritDoc} + * @inheritDoc */ - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { return $this->handler->isHandling($record); } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { return $this->handler->handle($record); } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { @@ -68,7 +66,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { @@ -76,7 +74,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * {@inheritDoc} + * @inheritDoc */ public function pushProcessor(callable $callback): HandlerInterface { @@ -90,7 +88,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * {@inheritDoc} + * @inheritDoc */ public function popProcessor(): callable { @@ -102,7 +100,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -116,7 +114,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { @@ -127,7 +125,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F throw new \LogicException('The wrapped handler does not implement ' . FormattableHandlerInterface::class); } - public function reset() + public function reset(): void { if ($this->handler instanceof ResettableInterface) { $this->handler->reset(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php index 000ccea4..ee7f81f6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * IFTTTHandler uses cURL to trigger IFTTT Maker actions @@ -27,16 +28,14 @@ use Monolog\Utils; */ class IFTTTHandler extends AbstractProcessingHandler { - /** @var string */ - private $eventName; - /** @var string */ - private $secretKey; + private string $eventName; + private string $secretKey; /** * @param string $eventName The name of the IFTTT Maker event that should be triggered * @param string $secretKey A valid IFTTT secret key */ - public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true) + public function __construct(string $eventName, string $secretKey, int|string|Level $level = Level::Error, bool $bubble = true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the IFTTTHandler'); @@ -49,14 +48,14 @@ class IFTTTHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - public function write(array $record): void + public function write(LogRecord $record): void { $postData = [ - "value1" => $record["channel"], + "value1" => $record->channel, "value2" => $record["level_name"], - "value3" => $record["message"], + "value3" => $record->message, ]; $postString = Utils::jsonEncode($postData); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php index 71f64a26..abb2f88f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php @@ -11,7 +11,8 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * Inspired on LogEntriesHandler. @@ -21,15 +22,12 @@ use Monolog\Logger; */ class InsightOpsHandler extends SocketHandler { - /** - * @var string - */ - protected $logToken; + protected string $logToken; /** - * @param string $token Log token supplied by InsightOps - * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. - * @param bool $useSSL Whether or not SSL encryption should be used + * @param string $token Log token supplied by InsightOps + * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. + * @param bool $useSSL Whether or not SSL encryption should be used * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ @@ -37,7 +35,7 @@ class InsightOpsHandler extends SocketHandler string $token, string $region = 'us', bool $useSSL = true, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -67,10 +65,10 @@ class InsightOpsHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { - return $this->logToken . ' ' . $record['formatted']; + return $this->logToken . ' ' . $record->formatted; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php index 25fcd159..00259834 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php @@ -11,29 +11,27 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * @author Robert Kaufmann III */ class LogEntriesHandler extends SocketHandler { - /** - * @var string - */ - protected $logToken; + protected string $logToken; /** - * @param string $token Log token supplied by LogEntries - * @param bool $useSSL Whether or not SSL encryption should be used. - * @param string $host Custom hostname to send the data to if needed + * @param string $token Log token supplied by LogEntries + * @param bool $useSSL Whether or not SSL encryption should be used. + * @param string $host Custom hostname to send the data to if needed * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ public function __construct( string $token, bool $useSSL = true, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, string $host = 'data.logentries.com', bool $persistent = false, @@ -61,10 +59,10 @@ class LogEntriesHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { - return $this->logToken . ' ' . $record['formatted']; + return $this->logToken . ' ' . $record->formatted; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php index 6d13db37..2d8e66f1 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php @@ -11,11 +11,12 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LogglyFormatter; use function array_key_exists; use CurlHandle; +use Monolog\LogRecord; /** * Sends errors to Loggly. @@ -33,22 +34,21 @@ class LogglyHandler extends AbstractProcessingHandler /** * Caches the curl handlers for every given endpoint. * - * @var resource[]|CurlHandle[] + * @var CurlHandle[] */ - protected $curlHandlers = []; + protected array $curlHandlers = []; - /** @var string */ - protected $token; + protected string $token; /** @var string[] */ - protected $tag = []; + protected array $tag = []; /** * @param string $token API token supplied by Loggly * * @throws MissingExtensionException If the curl extension is missing */ - public function __construct(string $token, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(string $token, int|string|Level $level = Level::Debug, bool $bubble = true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the LogglyHandler'); @@ -61,12 +61,8 @@ class LogglyHandler extends AbstractProcessingHandler /** * Loads and returns the shared curl handler for the given endpoint. - * - * @param string $endpoint - * - * @return resource|CurlHandle */ - protected function getCurlHandler(string $endpoint) + protected function getCurlHandler(string $endpoint): CurlHandle { if (!array_key_exists($endpoint, $this->curlHandlers)) { $this->curlHandlers[$endpoint] = $this->loadCurlHandle($endpoint); @@ -77,12 +73,8 @@ class LogglyHandler extends AbstractProcessingHandler /** * Starts a fresh curl session for the given endpoint and returns its handler. - * - * @param string $endpoint - * - * @return resource|CurlHandle */ - private function loadCurlHandle(string $endpoint) + private function loadCurlHandle(string $endpoint): CurlHandle { $url = sprintf("https://%s/%s/%s/", static::HOST, $endpoint, $this->token); @@ -98,10 +90,13 @@ class LogglyHandler extends AbstractProcessingHandler /** * @param string[]|string $tag */ - public function setTag($tag): self + public function setTag(string|array $tag): self { - $tag = !empty($tag) ? $tag : []; - $this->tag = is_array($tag) ? $tag : [$tag]; + if ('' === $tag || [] === $tag) { + $this->tag = []; + } else { + $this->tag = is_array($tag) ? $tag : [$tag]; + } return $this; } @@ -109,9 +104,9 @@ class LogglyHandler extends AbstractProcessingHandler /** * @param string[]|string $tag */ - public function addTag($tag): self + public function addTag(string|array $tag): self { - if (!empty($tag)) { + if ('' !== $tag) { $tag = is_array($tag) ? $tag : [$tag]; $this->tag = array_unique(array_merge($this->tag, $tag)); } @@ -119,9 +114,9 @@ class LogglyHandler extends AbstractProcessingHandler return $this; } - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->send($record["formatted"], static::ENDPOINT_SINGLE); + $this->send($record->formatted, static::ENDPOINT_SINGLE); } public function handleBatch(array $records): void @@ -129,10 +124,10 @@ class LogglyHandler extends AbstractProcessingHandler $level = $this->level; $records = array_filter($records, function ($record) use ($level) { - return ($record['level'] >= $level); + return ($record->level >= $level); }); - if ($records) { + if (\count($records) > 0) { $this->send($this->getFormatter()->formatBatch($records), static::ENDPOINT_BATCH); } } @@ -143,7 +138,7 @@ class LogglyHandler extends AbstractProcessingHandler $headers = ['Content-Type: application/json']; - if (!empty($this->tag)) { + if (\count($this->tag) > 0) { $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php index 859a4690..876b1a95 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php @@ -11,44 +11,36 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LogmaticFormatter; +use Monolog\LogRecord; /** * @author Julien Breux */ class LogmaticHandler extends SocketHandler { - /** - * @var string - */ - private $logToken; + private string $logToken; + + private string $hostname; + + private string $appName; /** - * @var string - */ - private $hostname; - - /** - * @var string - */ - private $appname; - - /** - * @param string $token Log token supplied by Logmatic. - * @param string $hostname Host name supplied by Logmatic. - * @param string $appname Application name supplied by Logmatic. - * @param bool $useSSL Whether or not SSL encryption should be used. + * @param string $token Log token supplied by Logmatic. + * @param string $hostname Host name supplied by Logmatic. + * @param string $appName Application name supplied by Logmatic. + * @param bool $useSSL Whether or not SSL encryption should be used. * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ public function __construct( string $token, string $hostname = '', - string $appname = '', + string $appName = '', bool $useSSL = true, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -76,29 +68,29 @@ class LogmaticHandler extends SocketHandler $this->logToken = $token; $this->hostname = $hostname; - $this->appname = $appname; + $this->appName = $appName; } /** - * {@inheritDoc} + * @inheritDoc */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { - return $this->logToken . ' ' . $record['formatted']; + return $this->logToken . ' ' . $record->formatted; } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { $formatter = new LogmaticFormatter(); - if (!empty($this->hostname)) { + if ($this->hostname !== '') { $formatter->setHostname($this->hostname); } - if (!empty($this->appname)) { - $formatter->setAppname($this->appname); + if ($this->appName !== '') { + $formatter->setAppName($this->appName); } return $formatter; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php index 97f34320..b6c82277 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php @@ -13,33 +13,32 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\HtmlFormatter; +use Monolog\LogRecord; /** * Base class for all mail handlers * * @author Gyula Sallai - * - * @phpstan-import-type Record from \Monolog\Logger */ abstract class MailHandler extends AbstractProcessingHandler { /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { $messages = []; foreach ($records as $record) { - if ($record['level'] < $this->level) { + if ($record->level->isLowerThan($this->level)) { continue; } - /** @var Record $message */ + $message = $this->processRecord($record); $messages[] = $message; } - if (!empty($messages)) { + if (\count($messages) > 0) { $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); } } @@ -50,27 +49,26 @@ abstract class MailHandler extends AbstractProcessingHandler * @param string $content formatted email body to be sent * @param array $records the array of log records that formed this content * - * @phpstan-param Record[] $records + * @phpstan-param non-empty-array $records */ abstract protected function send(string $content, array $records): void; /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->send((string) $record['formatted'], [$record]); + $this->send((string) $record->formatted, [$record]); } /** - * @phpstan-param non-empty-array $records - * @phpstan-return Record + * @phpstan-param non-empty-array $records */ - protected function getHighestRecord(array $records): array + protected function getHighestRecord(array $records): LogRecord { $highestRecord = null; foreach ($records as $record) { - if ($highestRecord === null || $highestRecord['level'] < $record['level']) { + if ($highestRecord === null || $record->level->isHigherThan($highestRecord->level)) { $highestRecord = $record; } } @@ -85,8 +83,6 @@ abstract class MailHandler extends AbstractProcessingHandler /** * Gets the default formatter. - * - * @return FormatterInterface */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php index 3003500e..0f923bc5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Swift; use Swift_Message; @@ -22,22 +22,20 @@ use Swift_Message; */ class MandrillHandler extends MailHandler { - /** @var Swift_Message */ - protected $message; - /** @var string */ - protected $apiKey; + protected Swift_Message $message; + protected string $apiKey; /** - * @psalm-param Swift_Message|callable(): Swift_Message $message + * @phpstan-param (Swift_Message|callable(): Swift_Message) $message * * @param string $apiKey A valid Mandrill API key * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced */ - public function __construct(string $apiKey, $message, $level = Logger::ERROR, bool $bubble = true) + public function __construct(string $apiKey, callable|Swift_Message $message, int|string|Level $level = Level::Error, bool $bubble = true) { parent::__construct($level, $bubble); - if (!$message instanceof Swift_Message && is_callable($message)) { + if (!$message instanceof Swift_Message) { $message = $message(); } if (!$message instanceof Swift_Message) { @@ -48,7 +46,7 @@ class MandrillHandler extends MailHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function send(string $content, array $records): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php index 30630911..33ab68c6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php @@ -14,9 +14,10 @@ namespace Monolog\Handler; use MongoDB\Driver\BulkWrite; use MongoDB\Driver\Manager; use MongoDB\Client; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\MongoDBFormatter; +use Monolog\LogRecord; /** * Logs to a MongoDB database. @@ -33,12 +34,11 @@ use Monolog\Formatter\MongoDBFormatter; */ class MongoDBHandler extends AbstractProcessingHandler { - /** @var \MongoDB\Collection */ - private $collection; - /** @var Client|Manager */ - private $manager; - /** @var string */ - private $namespace; + private \MongoDB\Collection $collection; + + private Client|Manager $manager; + + private string|null $namespace = null; /** * Constructor. @@ -47,12 +47,8 @@ class MongoDBHandler extends AbstractProcessingHandler * @param string $database Database name * @param string $collection Collection name */ - public function __construct($mongodb, string $database, string $collection, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(Client|Manager $mongodb, string $database, string $collection, int|string|Level $level = Level::Debug, bool $bubble = true) { - if (!($mongodb instanceof Client || $mongodb instanceof Manager)) { - throw new \InvalidArgumentException('MongoDB\Client or MongoDB\Driver\Manager instance required'); - } - if ($mongodb instanceof Client) { $this->collection = $mongodb->selectCollection($database, $collection); } else { @@ -63,21 +59,21 @@ class MongoDBHandler extends AbstractProcessingHandler parent::__construct($level, $bubble); } - protected function write(array $record): void + protected function write(LogRecord $record): void { if (isset($this->collection)) { - $this->collection->insertOne($record['formatted']); + $this->collection->insertOne($record->formatted); } if (isset($this->manager, $this->namespace)) { $bulk = new BulkWrite; - $bulk->insert($record["formatted"]); + $bulk->insert($record->formatted); $this->manager->executeBulkWrite($this->namespace, $bulk); } } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php index 0c0a3bdb..d4c9d801 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\LineFormatter; /** @@ -26,43 +26,39 @@ class NativeMailerHandler extends MailHandler * The email addresses to which the message will be sent * @var string[] */ - protected $to; + protected array $to; /** * The subject of the email - * @var string */ - protected $subject; + protected string $subject; /** * Optional headers for the message * @var string[] */ - protected $headers = []; + protected array $headers = []; /** * Optional parameters for the message * @var string[] */ - protected $parameters = []; + protected array $parameters = []; /** * The wordwrap length for the message - * @var int */ - protected $maxColumnWidth; + protected int $maxColumnWidth; /** * The Content-type for the message - * @var string|null */ - protected $contentType; + protected string|null $contentType = null; /** * The encoding for the message - * @var string */ - protected $encoding = 'utf-8'; + protected string $encoding = 'utf-8'; /** * @param string|string[] $to The receiver of the mail @@ -70,7 +66,7 @@ class NativeMailerHandler extends MailHandler * @param string $from The sender of the mail * @param int $maxColumnWidth The maximum column width that the message lines will have */ - public function __construct($to, string $subject, string $from, $level = Logger::ERROR, bool $bubble = true, int $maxColumnWidth = 70) + public function __construct(string|array $to, string $subject, string $from, int|string|Level $level = Level::Error, bool $bubble = true, int $maxColumnWidth = 70) { parent::__construct($level, $bubble); $this->to = (array) $to; @@ -109,11 +105,11 @@ class NativeMailerHandler extends MailHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function send(string $content, array $records): void { - $contentType = $this->getContentType() ?: ($this->isHtmlBody($content) ? 'text/html' : 'text/plain'); + $contentType = $this->getContentType() ?? ($this->isHtmlBody($content) ? 'text/html' : 'text/plain'); if ($contentType !== 'text/html') { $content = wordwrap($content, $this->maxColumnWidth); @@ -125,11 +121,8 @@ class NativeMailerHandler extends MailHandler $headers .= 'MIME-Version: 1.0' . "\r\n"; } - $subject = $this->subject; - if ($records) { - $subjectFormatter = new LineFormatter($this->subject); - $subject = $subjectFormatter->format($this->getHighestRecord($records)); - } + $subjectFormatter = new LineFormatter($this->subject); + $subject = $subjectFormatter->format($this->getHighestRecord($records)); $parameters = implode(' ', $this->parameters); foreach ($this->to as $to) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php index 114d749e..b8cb3785 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php @@ -11,16 +11,17 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Class to record a log on a NewRelic application. * Enabling New Relic High Security mode may prevent capture of useful information. * - * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted'] + * This handler requires a NormalizerFormatter to function and expects an array in $record->formatted * * @see https://docs.newrelic.com/docs/agents/php-agent * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security @@ -28,75 +29,58 @@ use Monolog\Formatter\FormatterInterface; class NewRelicHandler extends AbstractProcessingHandler { /** - * Name of the New Relic application that will receive logs from this handler. - * - * @var ?string - */ - protected $appName; - - /** - * Name of the current transaction - * - * @var ?string - */ - protected $transactionName; - - /** - * Some context and extra data is passed into the handler as arrays of values. Do we send them as is - * (useful if we are using the API), or explode them for display on the NewRelic RPM website? - * - * @var bool - */ - protected $explodeArrays; - - /** - * {@inheritDoc} - * - * @param string|null $appName - * @param bool $explodeArrays - * @param string|null $transactionName + * @inheritDoc */ public function __construct( - $level = Logger::ERROR, + int|string|Level $level = Level::Error, bool $bubble = true, - ?string $appName = null, - bool $explodeArrays = false, - ?string $transactionName = null + + /** + * Name of the New Relic application that will receive logs from this handler. + */ + protected string|null $appName = null, + + /** + * Some context and extra data is passed into the handler as arrays of values. Do we send them as is + * (useful if we are using the API), or explode them for display on the NewRelic RPM website? + */ + protected bool $explodeArrays = false, + + /** + * Name of the current transaction + */ + protected string|null $transactionName = null ) { parent::__construct($level, $bubble); - - $this->appName = $appName; - $this->explodeArrays = $explodeArrays; - $this->transactionName = $transactionName; } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { if (!$this->isNewRelicEnabled()) { throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); } - if ($appName = $this->getAppName($record['context'])) { + if (null !== ($appName = $this->getAppName($record->context))) { $this->setNewRelicAppName($appName); } - if ($transactionName = $this->getTransactionName($record['context'])) { + if (null !== ($transactionName = $this->getTransactionName($record->context))) { $this->setNewRelicTransactionName($transactionName); - unset($record['formatted']['context']['transaction_name']); + unset($record->formatted['context']['transaction_name']); } - if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) { - newrelic_notice_error($record['message'], $record['context']['exception']); - unset($record['formatted']['context']['exception']); + if (isset($record->context['exception']) && $record->context['exception'] instanceof \Throwable) { + newrelic_notice_error($record->message, $record->context['exception']); + unset($record->formatted['context']['exception']); } else { - newrelic_notice_error($record['message']); + newrelic_notice_error($record->message); } - if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { - foreach ($record['formatted']['context'] as $key => $parameter) { + if (isset($record->formatted['context']) && is_array($record->formatted['context'])) { + foreach ($record->formatted['context'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); @@ -107,8 +91,8 @@ class NewRelicHandler extends AbstractProcessingHandler } } - if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { - foreach ($record['formatted']['extra'] as $key => $parameter) { + if (isset($record->formatted['extra']) && is_array($record->formatted['extra'])) { + foreach ($record->formatted['extra'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); @@ -122,8 +106,6 @@ class NewRelicHandler extends AbstractProcessingHandler /** * Checks whether the NewRelic extension is enabled in the system. - * - * @return bool */ protected function isNewRelicEnabled(): bool { @@ -177,8 +159,7 @@ class NewRelicHandler extends AbstractProcessingHandler } /** - * @param string $key - * @param mixed $value + * @param mixed $value */ protected function setNewRelicParameter(string $key, $value): void { @@ -190,7 +171,7 @@ class NewRelicHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php index 1ddf0beb..d9fea180 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php @@ -11,6 +11,8 @@ namespace Monolog\Handler; +use Monolog\LogRecord; + /** * No-op * @@ -23,17 +25,17 @@ namespace Monolog\Handler; class NoopHandler extends Handler { /** - * {@inheritDoc} + * @inheritDoc */ - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { return true; } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { return false; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php index e75ee0c6..1aa84e4f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php @@ -11,8 +11,10 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Psr\Log\LogLevel; +use Monolog\Logger; +use Monolog\LogRecord; /** * Blackhole @@ -21,40 +23,34 @@ use Psr\Log\LogLevel; * to put on top of an existing stack to override it temporarily. * * @author Jordi Boggiano - * - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class NullHandler extends Handler { - /** - * @var int - */ - private $level; + private Level $level; /** - * @param string|int $level The minimum logging level at which this handler will be triggered + * @param string|int|Level $level The minimum logging level at which this handler will be triggered * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function __construct($level = Logger::DEBUG) + public function __construct(string|int|Level $level = Level::Debug) { $this->level = Logger::toMonologLevel($level); } /** - * {@inheritDoc} + * @inheritDoc */ - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { - return $record['level'] >= $this->level; + return $record->level->value >= $this->level->value; } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - return $record['level'] >= $this->level; + return $record->level->value >= $this->level->value; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php index 22068c9a..a72b7a11 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Handler to only pass log messages when a certain threshold of number of messages is reached. @@ -27,7 +28,7 @@ use Monolog\Formatter\FormatterInterface; * $handler = new SomeHandler(...) * * // Pass all warnings to the handler when more than 10 & all error messages when more then 5 - * $overflow = new OverflowHandler($handler, [Logger::WARNING => 10, Logger::ERROR => 5]); + * $overflow = new OverflowHandler($handler, [Level::Warning->value => 10, Level::Error->value => 5]); * * $log->pushHandler($overflow); *``` @@ -36,36 +37,25 @@ use Monolog\Formatter\FormatterInterface; */ class OverflowHandler extends AbstractHandler implements FormattableHandlerInterface { - /** @var HandlerInterface */ - private $handler; + private HandlerInterface $handler; - /** @var int[] */ - private $thresholdMap = [ - Logger::DEBUG => 0, - Logger::INFO => 0, - Logger::NOTICE => 0, - Logger::WARNING => 0, - Logger::ERROR => 0, - Logger::CRITICAL => 0, - Logger::ALERT => 0, - Logger::EMERGENCY => 0, - ]; + /** @var array */ + private array $thresholdMap = []; /** * Buffer of all messages passed to the handler before the threshold was reached * * @var mixed[][] */ - private $buffer = []; + private array $buffer = []; /** - * @param HandlerInterface $handler - * @param int[] $thresholdMap Dictionary of logger level => threshold + * @param array $thresholdMap Dictionary of log level value => threshold */ public function __construct( HandlerInterface $handler, array $thresholdMap = [], - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true ) { $this->handler = $handler; @@ -85,15 +75,15 @@ class OverflowHandler extends AbstractHandler implements FormattableHandlerInter * Unless the bubbling is interrupted (by returning true), the Logger class will keep on * calling further handlers in the stack with a given log record. * - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - if ($record['level'] < $this->level) { + if ($record->level->isLowerThan($this->level)) { return false; } - $level = $record['level']; + $level = $record->level->value; if (!isset($this->thresholdMap[$level])) { $this->thresholdMap[$level] = 0; @@ -122,7 +112,7 @@ class OverflowHandler extends AbstractHandler implements FormattableHandlerInter } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -136,7 +126,7 @@ class OverflowHandler extends AbstractHandler implements FormattableHandlerInter } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php index 23a1d117..8aa78e4c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php @@ -13,11 +13,13 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; use PhpConsole\Connector; use PhpConsole\Handler as VendorPhpConsoleHandler; use PhpConsole\Helper; +use Monolog\LogRecord; +use PhpConsole\Storage; /** * Monolog handler for Google Chrome extension "PHP Console" @@ -37,14 +39,59 @@ use PhpConsole\Helper; * PC::debug($_SERVER); // PHP Console debugger for any type of vars * * @author Sergey Barbushin https://www.linkedin.com/in/barbushin + * @phpstan-type Options array{ + * enabled: bool, + * classesPartialsTraceIgnore: string[], + * debugTagsKeysInContext: array, + * useOwnErrorsHandler: bool, + * useOwnExceptionsHandler: bool, + * sourcesBasePath: string|null, + * registerHelper: bool, + * serverEncoding: string|null, + * headersLimit: int|null, + * password: string|null, + * enableSslOnlyMode: bool, + * ipMasks: string[], + * enableEvalListener: bool, + * dumperDetectCallbacks: bool, + * dumperLevelLimit: int, + * dumperItemsCountLimit: int, + * dumperItemSizeLimit: int, + * dumperDumpSizeLimit: int, + * detectDumpTraceAndSource: bool, + * dataStorage: Storage|null + * } + * @phpstan-type InputOptions array{ + * enabled?: bool, + * classesPartialsTraceIgnore?: string[], + * debugTagsKeysInContext?: array, + * useOwnErrorsHandler?: bool, + * useOwnExceptionsHandler?: bool, + * sourcesBasePath?: string|null, + * registerHelper?: bool, + * serverEncoding?: string|null, + * headersLimit?: int|null, + * password?: string|null, + * enableSslOnlyMode?: bool, + * ipMasks?: string[], + * enableEvalListener?: bool, + * dumperDetectCallbacks?: bool, + * dumperLevelLimit?: int, + * dumperItemsCountLimit?: int, + * dumperItemSizeLimit?: int, + * dumperDumpSizeLimit?: int, + * detectDumpTraceAndSource?: bool, + * dataStorage?: Storage|null + * } * - * @phpstan-import-type Record from \Monolog\Logger * @deprecated Since 2.8.0 and 3.2.0, PHPConsole is abandoned and thus we will drop this handler in Monolog 4 */ class PHPConsoleHandler extends AbstractProcessingHandler { - /** @var array */ - private $options = [ + /** + * @phpstan-var Options + */ + private array $options = [ 'enabled' => true, // bool Is PHP Console server enabled 'classesPartialsTraceIgnore' => ['Monolog\\'], // array Hide calls of classes started with... 'debugTagsKeysInContext' => [0, 'tag'], // bool Is PHP Console server enabled @@ -67,15 +114,15 @@ class PHPConsoleHandler extends AbstractProcessingHandler 'dataStorage' => null, // \PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ) ]; - /** @var Connector */ - private $connector; + private Connector $connector; /** * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) * @throws \RuntimeException + * @phpstan-param InputOptions $options */ - public function __construct(array $options = [], ?Connector $connector = null, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(array $options = [], ?Connector $connector = null, int|string|Level $level = Level::Debug, bool $bubble = true) { if (!class_exists('PhpConsole\Connector')) { throw new \RuntimeException('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); @@ -86,14 +133,16 @@ class PHPConsoleHandler extends AbstractProcessingHandler } /** - * @param array $options - * + * @param array $options * @return array + * + * @phpstan-param InputOptions $options + * @phpstan-return Options */ private function initOptions(array $options): array { $wrongOptions = array_diff(array_keys($options), array_keys($this->options)); - if ($wrongOptions) { + if (\count($wrongOptions) > 0) { throw new \RuntimeException('Unknown options: ' . implode(', ', $wrongOptions)); } @@ -102,8 +151,8 @@ class PHPConsoleHandler extends AbstractProcessingHandler private function initConnector(?Connector $connector = null): Connector { - if (!$connector) { - if ($this->options['dataStorage']) { + if (null === $connector) { + if ($this->options['dataStorage'] instanceof Storage) { Connector::setPostponeStorage($this->options['dataStorage']); } $connector = Connector::getInstance(); @@ -120,22 +169,22 @@ class PHPConsoleHandler extends AbstractProcessingHandler $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']); $handler->start(); } - if ($this->options['sourcesBasePath']) { + if (null !== $this->options['sourcesBasePath']) { $connector->setSourcesBasePath($this->options['sourcesBasePath']); } - if ($this->options['serverEncoding']) { + if (null !== $this->options['serverEncoding']) { $connector->setServerEncoding($this->options['serverEncoding']); } - if ($this->options['password']) { + if (null !== $this->options['password']) { $connector->setPassword($this->options['password']); } if ($this->options['enableSslOnlyMode']) { $connector->enableSslOnlyMode(); } - if ($this->options['ipMasks']) { + if (\count($this->options['ipMasks']) > 0) { $connector->setAllowedIpMasks($this->options['ipMasks']); } - if ($this->options['headersLimit']) { + if (null !== $this->options['headersLimit'] && $this->options['headersLimit'] > 0) { $connector->setHeadersLimit($this->options['headersLimit']); } if ($this->options['detectDumpTraceAndSource']) { @@ -168,7 +217,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler return $this->options; } - public function handle(array $record): bool + public function handle(LogRecord $record): bool { if ($this->options['enabled'] && $this->connector->isActiveClient()) { return parent::handle($record); @@ -180,48 +229,39 @@ class PHPConsoleHandler extends AbstractProcessingHandler /** * Writes the record down to the log of the implementing handler */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - if ($record['level'] < Logger::NOTICE) { + if ($record->level->isLowerThan(Level::Notice)) { $this->handleDebugRecord($record); - } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) { + } elseif (isset($record->context['exception']) && $record->context['exception'] instanceof \Throwable) { $this->handleExceptionRecord($record); } else { $this->handleErrorRecord($record); } } - /** - * @phpstan-param Record $record - */ - private function handleDebugRecord(array $record): void + private function handleDebugRecord(LogRecord $record): void { - $tags = $this->getRecordTags($record); - $message = $record['message']; - if ($record['context']) { - $message .= ' ' . Utils::jsonEncode($this->connector->getDumper()->dump(array_filter($record['context'])), null, true); + [$tags, $filteredContext] = $this->getRecordTags($record); + $message = $record->message; + if (\count($filteredContext) > 0) { + $message .= ' ' . Utils::jsonEncode($this->connector->getDumper()->dump(array_filter($filteredContext)), null, true); } $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']); } - /** - * @phpstan-param Record $record - */ - private function handleExceptionRecord(array $record): void + private function handleExceptionRecord(LogRecord $record): void { - $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']); + $this->connector->getErrorsDispatcher()->dispatchException($record->context['exception']); } - /** - * @phpstan-param Record $record - */ - private function handleErrorRecord(array $record): void + private function handleErrorRecord(LogRecord $record): void { - $context = $record['context']; + $context = $record->context; $this->connector->getErrorsDispatcher()->dispatchError( $context['code'] ?? null, - $context['message'] ?? $record['message'], + $context['message'] ?? $record->message, $context['file'] ?? null, $context['line'] ?? null, $this->options['classesPartialsTraceIgnore'] @@ -229,32 +269,32 @@ class PHPConsoleHandler extends AbstractProcessingHandler } /** - * @phpstan-param Record $record - * @return string + * @return array{string, mixed[]} */ - private function getRecordTags(array &$record) + private function getRecordTags(LogRecord $record): array { $tags = null; - if (!empty($record['context'])) { - $context = & $record['context']; + $filteredContext = []; + if ($record->context !== []) { + $filteredContext = $record->context; foreach ($this->options['debugTagsKeysInContext'] as $key) { - if (!empty($context[$key])) { - $tags = $context[$key]; + if (isset($filteredContext[$key])) { + $tags = $filteredContext[$key]; if ($key === 0) { - array_shift($context); + array_shift($filteredContext); } else { - unset($context[$key]); + unset($filteredContext[$key]); } break; } } } - return $tags ?: strtolower($record['level_name']); + return [$tags ?? $record->level->toPsrLogLevel(), $filteredContext]; } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php index 8a8cf1be..9edc9ac5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php @@ -11,7 +11,8 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * Stores to STDIN of any process, specified by a command. @@ -33,20 +34,14 @@ class ProcessHandler extends AbstractProcessingHandler */ private $process; - /** - * @var string - */ - private $command; + private string $command; - /** - * @var string|null - */ - private $cwd; + private ?string $cwd; /** * @var resource[] */ - private $pipes = []; + private array $pipes = []; /** * @var array @@ -63,7 +58,7 @@ class ProcessHandler extends AbstractProcessingHandler * @param string|null $cwd "Current working directory" (CWD) for the process to be executed in. * @throws \InvalidArgumentException */ - public function __construct(string $command, $level = Logger::DEBUG, bool $bubble = true, ?string $cwd = null) + public function __construct(string $command, int|string|Level $level = Level::Debug, bool $bubble = true, ?string $cwd = null) { if ($command === '') { throw new \InvalidArgumentException('The command argument must be a non-empty string.'); @@ -83,14 +78,14 @@ class ProcessHandler extends AbstractProcessingHandler * * @throws \UnexpectedValueException */ - protected function write(array $record): void + protected function write(LogRecord $record): void { $this->ensureProcessIsStarted(); - $this->writeProcessInput($record['formatted']); + $this->writeProcessInput($record->formatted); $errors = $this->readProcessErrors(); - if (empty($errors) === false) { + if ($errors !== '') { throw new \UnexpectedValueException(sprintf('Errors while writing to process: %s', $errors)); } } @@ -134,7 +129,7 @@ class ProcessHandler extends AbstractProcessingHandler $errors = $this->readProcessErrors(); - if (is_resource($this->process) === false || empty($errors) === false) { + if (is_resource($this->process) === false || $errors !== '') { throw new \UnexpectedValueException( sprintf('The process "%s" could not be opened: ' . $errors, $this->command) ); @@ -176,7 +171,7 @@ class ProcessHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php index 3adec7a4..9fb290fa 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php @@ -12,20 +12,19 @@ namespace Monolog\Handler; use Monolog\Processor\ProcessorInterface; +use Monolog\LogRecord; /** * Interface to describe loggers that have processors * * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger */ interface ProcessableHandlerInterface { /** * Adds a processor in the stack. * - * @psalm-param ProcessorInterface|callable(Record): Record $callback + * @phpstan-param ProcessorInterface|(callable(LogRecord): LogRecord) $callback * * @param ProcessorInterface|callable $callback * @return HandlerInterface self @@ -35,7 +34,7 @@ interface ProcessableHandlerInterface /** * Removes the processor on top of the stack and returns it. * - * @psalm-return ProcessorInterface|callable(Record): Record $callback + * @phpstan-return ProcessorInterface|(callable(LogRecord): LogRecord) $callback * * @throws \LogicException In case the processor stack is empty * @return callable|ProcessorInterface diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php index 9ef6e301..74eedddd 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php @@ -13,24 +13,23 @@ namespace Monolog\Handler; use Monolog\ResettableInterface; use Monolog\Processor\ProcessorInterface; +use Monolog\LogRecord; /** * Helper trait for implementing ProcessableInterface * * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger */ trait ProcessableHandlerTrait { /** * @var callable[] - * @phpstan-var array + * @phpstan-var array<(callable(LogRecord): LogRecord)|ProcessorInterface> */ - protected $processors = []; + protected array $processors = []; /** - * {@inheritDoc} + * @inheritDoc */ public function pushProcessor(callable $callback): HandlerInterface { @@ -40,24 +39,18 @@ trait ProcessableHandlerTrait } /** - * {@inheritDoc} + * @inheritDoc */ public function popProcessor(): callable { - if (!$this->processors) { + if (\count($this->processors) === 0) { throw new \LogicException('You tried to pop from an empty processor stack.'); } return array_shift($this->processors); } - /** - * Processes a record. - * - * @phpstan-param Record $record - * @phpstan-return Record - */ - protected function processRecord(array $record): array + protected function processRecord(LogRecord $record): LogRecord { foreach ($this->processors as $processor) { $record = $processor($record); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php index 36e19ccc..6599a83b 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php @@ -11,9 +11,10 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Psr\Log\LoggerInterface; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Proxies log messages to an existing PSR-3 compliant logger. @@ -28,20 +29,15 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface { /** * PSR-3 compliant logger - * - * @var LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; - /** - * @var FormatterInterface|null - */ - protected $formatter; + protected FormatterInterface|null $formatter = null; /** * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied */ - public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(LoggerInterface $logger, int|string|Level $level = Level::Debug, bool $bubble = true) { parent::__construct($level, $bubble); @@ -49,19 +45,19 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { if (!$this->isHandling($record)) { return false; } - if ($this->formatter) { + if ($this->formatter !== null) { $formatted = $this->formatter->format($record); - $this->logger->log(strtolower($record['level_name']), (string) $formatted, $record['context']); + $this->logger->log($record->level->toPsrLogLevel(), (string) $formatted, $record->context); } else { - $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); + $this->logger->log($record->level->toPsrLogLevel(), $record->message, $record->context); } return false === $this->bubble; @@ -69,8 +65,6 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface /** * Sets the formatter. - * - * @param FormatterInterface $formatter */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -81,12 +75,10 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface /** * Gets the formatter. - * - * @return FormatterInterface */ public function getFormatter(): FormatterInterface { - if (!$this->formatter) { + if ($this->formatter === null) { throw new \LogicException('No formatter has been set and this handler does not have a default formatter'); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php index fed2303d..118f5760 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php @@ -11,48 +11,45 @@ namespace Monolog\Handler; +use Monolog\Level; use Monolog\Logger; use Monolog\Utils; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Sends notifications through the pushover api to mobile phones * * @author Sebastian Göttschkes * @see https://www.pushover.net/api - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class PushoverHandler extends SocketHandler { - /** @var string */ - private $token; - /** @var array */ - private $users; - /** @var string */ - private $title; - /** @var string|int|null */ - private $user = null; - /** @var int */ - private $retry; - /** @var int */ - private $expire; + private string $token; - /** @var int */ - private $highPriorityLevel; - /** @var int */ - private $emergencyLevel; - /** @var bool */ - private $useFormattedMessage = false; + /** @var array */ + private array $users; + + private string $title; + + private string|int|null $user = null; + + private int $retry; + + private int $expire; + + private Level $highPriorityLevel; + + private Level $emergencyLevel; + + private bool $useFormattedMessage = false; /** * All parameters that can be sent to Pushover * @see https://pushover.net/api * @var array */ - private $parameterNames = [ + private array $parameterNames = [ 'token' => true, 'user' => true, 'message' => true, @@ -73,40 +70,42 @@ class PushoverHandler extends SocketHandler * @see https://pushover.net/api#sounds * @var string[] */ - private $sounds = [ + private array $sounds = [ 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', 'persistent', 'echo', 'updown', 'none', ]; /** - * @param string $token Pushover api token - * @param string|array $users Pushover user id or array of ids the message will be sent to - * @param string|null $title Title sent to the Pushover API - * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not - * the pushover.net app owner. OpenSSL is required for this option. - * @param string|int $highPriorityLevel The minimum logging level at which this handler will start - * sending "high priority" requests to the Pushover API - * @param string|int $emergencyLevel The minimum logging level at which this handler will start - * sending "emergency" requests to the Pushover API - * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will - * send the same notification to the user. - * @param int $expire The expire parameter specifies how many seconds your notification will continue - * to be retried for (every retry seconds). + * @param string $token Pushover api token + * @param string|array $users Pushover user id or array of ids the message will be sent to + * @param string|null $title Title sent to the Pushover API + * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not + * the pushover.net app owner. OpenSSL is required for this option. + * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will + * send the same notification to the user. + * @param int $expire The expire parameter specifies how many seconds your notification will continue + * to be retried for (every retry seconds). + * + * @param int|string|Level|LogLevel::* $highPriorityLevel The minimum logging level at which this handler will start + * sending "high priority" requests to the Pushover API + * @param int|string|Level|LogLevel::* $emergencyLevel The minimum logging level at which this handler will start + * sending "emergency" requests to the Pushover API + * * * @phpstan-param string|array $users - * @phpstan-param Level|LevelName|LogLevel::* $highPriorityLevel - * @phpstan-param Level|LevelName|LogLevel::* $emergencyLevel + * @phpstan-param value-of|value-of|Level|LogLevel::* $highPriorityLevel + * @phpstan-param value-of|value-of|Level|LogLevel::* $emergencyLevel */ public function __construct( string $token, $users, ?string $title = null, - $level = Logger::CRITICAL, + int|string|Level $level = Level::Critical, bool $bubble = true, bool $useSSL = true, - $highPriorityLevel = Logger::CRITICAL, - $emergencyLevel = Logger::EMERGENCY, + int|string|Level $highPriorityLevel = Level::Critical, + int|string|Level $emergencyLevel = Level::Emergency, int $retry = 30, int $expire = 25200, bool $persistent = false, @@ -129,32 +128,29 @@ class PushoverHandler extends SocketHandler $this->token = $token; $this->users = (array) $users; - $this->title = $title ?: (string) gethostname(); + $this->title = $title ?? (string) gethostname(); $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel); $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel); $this->retry = $retry; $this->expire = $expire; } - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } - /** - * @phpstan-param FormattedRecord $record - */ - private function buildContent(array $record): string + private function buildContent(LogRecord $record): string { // Pushover has a limit of 512 characters on title and message combined. $maxMessageLength = 512 - strlen($this->title); - $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message']; + $message = ($this->useFormattedMessage) ? $record->formatted : $record->message; $message = Utils::substr($message, 0, $maxMessageLength); - $timestamp = $record['datetime']->getTimestamp(); + $timestamp = $record->datetime->getTimestamp(); $dataArray = [ 'token' => $this->token, @@ -164,23 +160,23 @@ class PushoverHandler extends SocketHandler 'timestamp' => $timestamp, ]; - if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { + if ($record->level->value >= $this->emergencyLevel->value) { $dataArray['priority'] = 2; $dataArray['retry'] = $this->retry; $dataArray['expire'] = $this->expire; - } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) { + } elseif ($record->level->value >= $this->highPriorityLevel->value) { $dataArray['priority'] = 1; } // First determine the available parameters - $context = array_intersect_key($record['context'], $this->parameterNames); - $extra = array_intersect_key($record['extra'], $this->parameterNames); + $context = array_intersect_key($record->context, $this->parameterNames); + $extra = array_intersect_key($record->extra, $this->parameterNames); // Least important info should be merged with subsequent info $dataArray = array_merge($extra, $context, $dataArray); // Only pass sounds that are supported by the API - if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) { + if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds, true)) { unset($dataArray['sound']); } @@ -198,7 +194,7 @@ class PushoverHandler extends SocketHandler return $header; } - protected function write(array $record): void + protected function write(LogRecord $record): void { foreach ($this->users as $user) { $this->user = $user; @@ -211,25 +207,25 @@ class PushoverHandler extends SocketHandler } /** - * @param int|string $value + * @param int|string|Level|LogLevel::* $level * - * @phpstan-param Level|LevelName|LogLevel::* $value + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function setHighPriorityLevel($value): self + public function setHighPriorityLevel(int|string|Level $level): self { - $this->highPriorityLevel = Logger::toMonologLevel($value); + $this->highPriorityLevel = Logger::toMonologLevel($level); return $this; } /** - * @param int|string $value + * @param int|string|Level|LogLevel::* $level * - * @phpstan-param Level|LevelName|LogLevel::* $value + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function setEmergencyLevel($value): self + public function setEmergencyLevel(int|string|Level $level): self { - $this->emergencyLevel = Logger::toMonologLevel($value); + $this->emergencyLevel = Logger::toMonologLevel($level); return $this; } @@ -237,9 +233,9 @@ class PushoverHandler extends SocketHandler /** * Use the formatted message? */ - public function useFormattedMessage(bool $value): self + public function useFormattedMessage(bool $useFormattedMessage): self { - $this->useFormattedMessage = $value; + $this->useFormattedMessage = $useFormattedMessage; return $this; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php index 91d16eaf..5eee5dc6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php @@ -13,7 +13,10 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; +use Predis\Client as Predis; +use Redis; /** * Logs to a Redis key using rpush @@ -25,29 +28,21 @@ use Monolog\Logger; * $log->pushHandler($redis); * * @author Thomas Tourlourat - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class RedisHandler extends AbstractProcessingHandler { - /** @var \Predis\Client<\Predis\Client>|\Redis */ - private $redisClient; - /** @var string */ - private $redisKey; - /** @var int */ - protected $capSize; + /** @var Predis|Redis */ + private Predis|Redis $redisClient; + private string $redisKey; + protected int $capSize; /** - * @param \Predis\Client<\Predis\Client>|\Redis $redis The redis instance - * @param string $key The key name to push records to - * @param int $capSize Number of entries to limit list size to, 0 = unlimited + * @param Predis|Redis $redis The redis instance + * @param string $key The key name to push records to + * @param int $capSize Number of entries to limit list size to, 0 = unlimited */ - public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true, int $capSize = 0) + public function __construct(Predis|Redis $redis, string $key, int|string|Level $level = Level::Debug, bool $bubble = true, int $capSize = 0) { - if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { - throw new \InvalidArgumentException('Predis\Client or Redis instance required'); - } - $this->redisClient = $redis; $this->redisKey = $key; $this->capSize = $capSize; @@ -56,43 +51,41 @@ class RedisHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - if ($this->capSize) { + if ($this->capSize > 0) { $this->writeCapped($record); } else { - $this->redisClient->rpush($this->redisKey, $record["formatted"]); + $this->redisClient->rpush($this->redisKey, $record->formatted); } } /** * Write and cap the collection * Writes the record to the redis list and caps its - * - * @phpstan-param FormattedRecord $record */ - protected function writeCapped(array $record): void + protected function writeCapped(LogRecord $record): void { - if ($this->redisClient instanceof \Redis) { - $mode = defined('\Redis::MULTI') ? \Redis::MULTI : 1; + if ($this->redisClient instanceof Redis) { + $mode = defined('Redis::MULTI') ? Redis::MULTI : 1; $this->redisClient->multi($mode) - ->rpush($this->redisKey, $record["formatted"]) + ->rPush($this->redisKey, $record->formatted) ->ltrim($this->redisKey, -$this->capSize, -1) ->exec(); } else { $redisKey = $this->redisKey; $capSize = $this->capSize; $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { - $tx->rpush($redisKey, $record["formatted"]); + $tx->rpush($redisKey, $record->formatted); $tx->ltrim($redisKey, -$capSize, -1); }); } } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php index 7789309c..fa8e9e9f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php @@ -13,7 +13,10 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; +use Predis\Client as Predis; +use Redis; /** * Sends the message to a Redis Pub/Sub channel using PUBLISH @@ -21,28 +24,23 @@ use Monolog\Logger; * usage example: * * $log = new Logger('application'); - * $redis = new RedisPubSubHandler(new Predis\Client("tcp://localhost:6379"), "logs", Logger::WARNING); + * $redis = new RedisPubSubHandler(new Predis\Client("tcp://localhost:6379"), "logs", Level::Warning); * $log->pushHandler($redis); * * @author Gaëtan Faugère */ class RedisPubSubHandler extends AbstractProcessingHandler { - /** @var \Predis\Client<\Predis\Client>|\Redis */ - private $redisClient; - /** @var string */ - private $channelKey; + /** @var Predis|Redis */ + private Predis|Redis $redisClient; + private string $channelKey; /** - * @param \Predis\Client<\Predis\Client>|\Redis $redis The redis instance - * @param string $key The channel key to publish records to + * @param Predis|Redis $redis The redis instance + * @param string $key The channel key to publish records to */ - public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(Predis|Redis $redis, string $key, int|string|Level $level = Level::Debug, bool $bubble = true) { - if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { - throw new \InvalidArgumentException('Predis\Client or Redis instance required'); - } - $this->redisClient = $redis; $this->channelKey = $key; @@ -50,15 +48,15 @@ class RedisPubSubHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->redisClient->publish($this->channelKey, $record["formatted"]); + $this->redisClient->publish($this->channelKey, $record->formatted); } /** - * {@inheritDoc} + * @inheritDoc */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php index adcc9395..1d124723 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php @@ -11,9 +11,10 @@ namespace Monolog\Handler; +use Monolog\Level; use Rollbar\RollbarLogger; use Throwable; -use Monolog\Logger; +use Monolog\LogRecord; /** * Sends errors to Rollbar @@ -33,37 +34,19 @@ use Monolog\Logger; */ class RollbarHandler extends AbstractProcessingHandler { - /** - * @var RollbarLogger - */ - protected $rollbarLogger; - - /** @var string[] */ - protected $levelMap = [ - Logger::DEBUG => 'debug', - Logger::INFO => 'info', - Logger::NOTICE => 'info', - Logger::WARNING => 'warning', - Logger::ERROR => 'error', - Logger::CRITICAL => 'critical', - Logger::ALERT => 'critical', - Logger::EMERGENCY => 'critical', - ]; + protected RollbarLogger $rollbarLogger; /** * Records whether any log records have been added since the last flush of the rollbar notifier - * - * @var bool */ - private $hasRecords = false; + private bool $hasRecords = false; - /** @var bool */ - protected $initialized = false; + protected bool $initialized = false; /** * @param RollbarLogger $rollbarLogger RollbarLogger object constructed with valid token */ - public function __construct(RollbarLogger $rollbarLogger, $level = Logger::ERROR, bool $bubble = true) + public function __construct(RollbarLogger $rollbarLogger, int|string|Level $level = Level::Error, bool $bubble = true) { $this->rollbarLogger = $rollbarLogger; @@ -71,22 +54,41 @@ class RollbarHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * Translates Monolog log levels to Rollbar levels. + * + * @return 'debug'|'info'|'warning'|'error'|'critical' */ - protected function write(array $record): void + protected function toRollbarLevel(Level $level): string + { + return match ($level) { + Level::Debug => 'debug', + Level::Info => 'info', + Level::Notice => 'info', + Level::Warning => 'warning', + Level::Error => 'error', + Level::Critical => 'critical', + Level::Alert => 'critical', + Level::Emergency => 'critical', + }; + } + + /** + * @inheritDoc + */ + protected function write(LogRecord $record): void { if (!$this->initialized) { // __destructor() doesn't get called on Fatal errors - register_shutdown_function(array($this, 'close')); + register_shutdown_function([$this, 'close']); $this->initialized = true; } - $context = $record['context']; - $context = array_merge($context, $record['extra'], [ - 'level' => $this->levelMap[$record['level']], - 'monolog_level' => $record['level_name'], - 'channel' => $record['channel'], - 'datetime' => $record['datetime']->format('U'), + $context = $record->context; + $context = array_merge($context, $record->extra, [ + 'level' => $this->toRollbarLevel($record->level), + 'monolog_level' => $record->level->getName(), + 'channel' => $record->channel, + 'datetime' => $record->datetime->format('U'), ]); if (isset($context['exception']) && $context['exception'] instanceof Throwable) { @@ -94,7 +96,7 @@ class RollbarHandler extends AbstractProcessingHandler unset($context['exception']); $toLog = $exception; } else { - $toLog = $record['message']; + $toLog = $record->message; } // @phpstan-ignore-next-line @@ -112,7 +114,7 @@ class RollbarHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { @@ -120,9 +122,9 @@ class RollbarHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - public function reset() + public function reset(): void { $this->flush(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php index 17745d22..12ce6923 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php @@ -12,8 +12,9 @@ namespace Monolog\Handler; use InvalidArgumentException; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Stores logs to files that are rotated every day and a limited number of files are kept. @@ -30,26 +31,19 @@ class RotatingFileHandler extends StreamHandler public const FILE_PER_MONTH = 'Y-m'; public const FILE_PER_YEAR = 'Y'; - /** @var string */ - protected $filename; - /** @var int */ - protected $maxFiles; - /** @var bool */ - protected $mustRotate; - /** @var \DateTimeImmutable */ - protected $nextRotation; - /** @var string */ - protected $filenameFormat; - /** @var string */ - protected $dateFormat; + protected string $filename; + protected int $maxFiles; + protected bool|null $mustRotate = null; + protected \DateTimeImmutable $nextRotation; + protected string $filenameFormat; + protected string $dateFormat; /** - * @param string $filename - * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) - * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) - * @param bool $useLocking Try to lock log file before doing any writes + * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes */ - public function __construct(string $filename, int $maxFiles = 0, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) + public function __construct(string $filename, int $maxFiles = 0, int|string|Level $level = Level::Debug, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) { $this->filename = Utils::canonicalizePath($filename); $this->maxFiles = $maxFiles; @@ -61,7 +55,7 @@ class RotatingFileHandler extends StreamHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { @@ -73,9 +67,9 @@ class RotatingFileHandler extends StreamHandler } /** - * {@inheritDoc} + * @inheritDoc */ - public function reset() + public function reset(): void { parent::reset(); @@ -86,7 +80,7 @@ class RotatingFileHandler extends StreamHandler public function setFilenameFormat(string $filenameFormat, string $dateFormat): self { - if (!preg_match('{^[Yy](([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { + if (0 === preg_match('{^[Yy](([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { throw new InvalidArgumentException( 'Invalid date format - format must be one of '. 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. @@ -108,16 +102,16 @@ class RotatingFileHandler extends StreamHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { // on the first record written, if the log is new, we should rotate (once per day) if (null === $this->mustRotate) { $this->mustRotate = null === $this->url || !file_exists($this->url); } - if ($this->nextRotation <= $record['datetime']) { + if ($this->nextRotation <= $record->datetime) { $this->mustRotate = true; $this->close(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php index c128a32d..511ec585 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php @@ -11,7 +11,9 @@ namespace Monolog\Handler; +use Closure; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Sampling handler @@ -26,52 +28,42 @@ use Monolog\Formatter\FormatterInterface; * * @author Bryan Davis * @author Kunal Mehta - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger */ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** - * @var HandlerInterface|callable - * @phpstan-var HandlerInterface|callable(Record|array{level: Level}|null, HandlerInterface): HandlerInterface - */ - protected $handler; - - /** - * @var int $factor - */ - protected $factor; - - /** - * @psalm-param HandlerInterface|callable(Record|array{level: Level}|null, HandlerInterface): HandlerInterface $handler + * Handler or factory Closure($record, $this) * - * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $samplingHandler). - * @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled) + * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface */ - public function __construct($handler, int $factor) + protected Closure|HandlerInterface $handler; + + protected int $factor; + + /** + * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler + * + * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $samplingHandler). + * @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled) + */ + public function __construct(Closure|HandlerInterface $handler, int $factor) { parent::__construct(); $this->handler = $handler; $this->factor = $factor; - - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); - } } - public function isHandling(array $record): bool + public function isHandling(LogRecord $record): bool { return $this->getHandler($record)->isHandling($record); } - public function handle(array $record): bool + public function handle(LogRecord $record): bool { if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } @@ -84,26 +76,23 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter /** * Return the nested handler * - * If the handler was provided as a factory callable, this will trigger the handler's instantiation. - * - * @phpstan-param Record|array{level: Level}|null $record - * - * @return HandlerInterface + * If the handler was provided as a factory, this will trigger the handler's instantiation. */ - public function getHandler(array $record = null) + public function getHandler(LogRecord $record = null): HandlerInterface { if (!$this->handler instanceof HandlerInterface) { - $this->handler = ($this->handler)($record, $this); - if (!$this->handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory callable should return a HandlerInterface"); + $handler = ($this->handler)($record, $this); + if (!$handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory Closure should return a HandlerInterface"); } + $this->handler = $handler; } return $this->handler; } /** - * {@inheritDoc} + * @inheritDoc */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -118,7 +107,7 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter } /** - * {@inheritDoc} + * @inheritDoc */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php index 1280ee70..6228a02f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; /** * SendGridrHandler uses the SendGrid API v2 function to send Log emails, more information in https://sendgrid.com/docs/API_Reference/Web_API/mail.html @@ -22,33 +22,29 @@ class SendGridHandler extends MailHandler { /** * The SendGrid API User - * @var string */ - protected $apiUser; + protected string $apiUser; /** * The SendGrid API Key - * @var string */ - protected $apiKey; + protected string $apiKey; /** * The email addresses to which the message will be sent - * @var string */ - protected $from; + protected string $from; /** * The email addresses to which the message will be sent * @var string[] */ - protected $to; + protected array $to; /** * The subject of the email - * @var string */ - protected $subject; + protected string $subject; /** * @param string $apiUser The SendGrid API User @@ -57,7 +53,7 @@ class SendGridHandler extends MailHandler * @param string|string[] $to The recipients of the email * @param string $subject The subject of the mail */ - public function __construct(string $apiUser, string $apiKey, string $from, $to, string $subject, $level = Logger::ERROR, bool $bubble = true) + public function __construct(string $apiUser, string $apiKey, string $from, string|array $to, string $subject, int|string|Level $level = Level::Error, bool $bubble = true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the SendGridHandler'); @@ -72,7 +68,7 @@ class SendGridHandler extends MailHandler } /** - * {@inheritDoc} + * @inheritDoc */ protected function send(string $content, array $records): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php index 71a41094..7e9cccc9 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php @@ -11,10 +11,11 @@ namespace Monolog\Handler\Slack; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; /** * Slack record utility helping to log to Slack webhooks or API. @@ -23,9 +24,6 @@ use Monolog\Formatter\FormatterInterface; * @author Haralan Dobrev * @see https://api.slack.com/incoming-webhooks * @see https://api.slack.com/docs/message-attachments - * - * @phpstan-import-type FormattedRecord from \Monolog\Handler\AbstractProcessingHandler - * @phpstan-import-type Record from \Monolog\Logger */ class SlackRecord { @@ -39,55 +37,43 @@ class SlackRecord /** * Slack channel (encoded ID or name) - * @var string|null */ - private $channel; + private string|null $channel; /** * Name of a bot - * @var string|null */ - private $username; + private string|null $username; /** * User icon e.g. 'ghost', 'http://example.com/user.png' - * @var string|null */ - private $userIcon; + private string|null $userIcon; /** * Whether the message should be added to Slack as attachment (plain text otherwise) - * @var bool */ - private $useAttachment; + private bool $useAttachment; /** * Whether the the context/extra messages added to Slack as attachments are in a short style - * @var bool */ - private $useShortAttachment; + private bool $useShortAttachment; /** * Whether the attachment should include context and extra data - * @var bool */ - private $includeContextAndExtra; + private bool $includeContextAndExtra; /** * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] * @var string[] */ - private $excludeFields; + private array $excludeFields; - /** - * @var ?FormatterInterface - */ - private $formatter; + private FormatterInterface|null $formatter; - /** - * @var NormalizerFormatter - */ - private $normalizerFormatter; + private NormalizerFormatter $normalizerFormatter; /** * @param string[] $excludeFields @@ -99,7 +85,7 @@ class SlackRecord ?string $userIcon = null, bool $useShortAttachment = false, bool $includeContextAndExtra = false, - array $excludeFields = array(), + array $excludeFields = [], FormatterInterface $formatter = null ) { $this @@ -121,77 +107,76 @@ class SlackRecord * Returns required data in format that Slack * is expecting. * - * @phpstan-param FormattedRecord $record * @phpstan-return mixed[] */ - public function getSlackData(array $record): array + public function getSlackData(LogRecord $record): array { - $dataArray = array(); - $record = $this->removeExcludedFields($record); + $dataArray = []; - if ($this->username) { + if ($this->username !== null) { $dataArray['username'] = $this->username; } - if ($this->channel) { + if ($this->channel !== null) { $dataArray['channel'] = $this->channel; } - if ($this->formatter && !$this->useAttachment) { - /** @phpstan-ignore-next-line */ + if ($this->formatter !== null && !$this->useAttachment) { $message = $this->formatter->format($record); } else { - $message = $record['message']; + $message = $record->message; } + $recordData = $this->removeExcludedFields($record); + if ($this->useAttachment) { - $attachment = array( - 'fallback' => $message, - 'text' => $message, - 'color' => $this->getAttachmentColor($record['level']), - 'fields' => array(), - 'mrkdwn_in' => array('fields'), - 'ts' => $record['datetime']->getTimestamp(), + $attachment = [ + 'fallback' => $message, + 'text' => $message, + 'color' => $this->getAttachmentColor($record->level), + 'fields' => [], + 'mrkdwn_in' => ['fields'], + 'ts' => $recordData['datetime']->getTimestamp(), 'footer' => $this->username, 'footer_icon' => $this->userIcon, - ); + ]; if ($this->useShortAttachment) { - $attachment['title'] = $record['level_name']; + $attachment['title'] = $recordData['level_name']; } else { $attachment['title'] = 'Message'; - $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); + $attachment['fields'][] = $this->generateAttachmentField('Level', $recordData['level_name']); } if ($this->includeContextAndExtra) { - foreach (array('extra', 'context') as $key) { - if (empty($record[$key])) { + foreach (['extra', 'context'] as $key) { + if (!isset($recordData[$key]) || \count($recordData[$key]) === 0) { continue; } if ($this->useShortAttachment) { $attachment['fields'][] = $this->generateAttachmentField( - (string) $key, - $record[$key] + $key, + $recordData[$key] ); } else { // Add all extra fields as individual fields in attachment $attachment['fields'] = array_merge( $attachment['fields'], - $this->generateAttachmentFields($record[$key]) + $this->generateAttachmentFields($recordData[$key]) ); } } } - $dataArray['attachments'] = array($attachment); + $dataArray['attachments'] = [$attachment]; } else { $dataArray['text'] = $message; } - if ($this->userIcon) { - if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { - $dataArray['icon_url'] = $this->userIcon; + if ($this->userIcon !== null) { + if (false !== ($iconUrl = filter_var($this->userIcon, FILTER_VALIDATE_URL))) { + $dataArray['icon_url'] = $iconUrl; } else { $dataArray['icon_emoji'] = ":{$this->userIcon}:"; } @@ -204,18 +189,14 @@ class SlackRecord * Returns a Slack message attachment color associated with * provided level. */ - public function getAttachmentColor(int $level): string + public function getAttachmentColor(Level $level): string { - switch (true) { - case $level >= Logger::ERROR: - return static::COLOR_DANGER; - case $level >= Logger::WARNING: - return static::COLOR_WARNING; - case $level >= Logger::INFO: - return static::COLOR_GOOD; - default: - return static::COLOR_DEFAULT; - } + return match ($level) { + Level::Error, Level::Critical, Level::Alert, Level::Emergency => static::COLOR_DANGER, + Level::Warning => static::COLOR_WARNING, + Level::Info, Level::Notice => static::COLOR_GOOD, + Level::Debug => static::COLOR_DEFAULT + }; } /** @@ -225,13 +206,13 @@ class SlackRecord */ public function stringify(array $fields): string { - /** @var Record $fields */ - $normalized = $this->normalizerFormatter->format($fields); + /** @var array $normalized */ + $normalized = $this->normalizerFormatter->normalizeValue($fields); - $hasSecondDimension = count(array_filter($normalized, 'is_array')); - $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); + $hasSecondDimension = \count(array_filter($normalized, 'is_array')) > 0; + $hasOnlyNonNumericKeys = \count(array_filter(array_keys($normalized), 'is_numeric')) === 0; - return $hasSecondDimension || $hasNonNumericKeys + return $hasSecondDimension || $hasOnlyNonNumericKeys ? Utils::jsonEncode($normalized, JSON_PRETTY_PRINT|Utils::DEFAULT_JSON_FLAGS) : Utils::jsonEncode($normalized, Utils::DEFAULT_JSON_FLAGS); } @@ -330,11 +311,11 @@ class SlackRecord ? sprintf('```%s```', substr($this->stringify($value), 0, 1990)) : $value; - return array( + return [ 'title' => ucfirst($title), 'value' => $value, 'short' => false, - ); + ]; } /** @@ -346,10 +327,10 @@ class SlackRecord */ private function generateAttachmentFields(array $data): array { - /** @var Record $data */ - $normalized = $this->normalizerFormatter->format($data); + /** @var array $normalized */ + $normalized = $this->normalizerFormatter->normalizeValue($data); - $fields = array(); + $fields = []; foreach ($normalized as $key => $value) { $fields[] = $this->generateAttachmentField((string) $key, $value); } @@ -360,15 +341,14 @@ class SlackRecord /** * Get a copy of record with fields excluded according to $this->excludeFields * - * @phpstan-param FormattedRecord $record - * * @return mixed[] */ - private function removeExcludedFields(array $record): array + private function removeExcludedFields(LogRecord $record): array { + $recordData = $record->toArray(); foreach ($this->excludeFields as $field) { $keys = explode('.', $field); - $node = &$record; + $node = &$recordData; $lastKey = end($keys); foreach ($keys as $key) { if (!isset($node[$key])) { @@ -382,6 +362,6 @@ class SlackRecord } } - return $record; + return $recordData; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php index a648513e..321d8660 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php @@ -12,31 +12,28 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; use Monolog\Handler\Slack\SlackRecord; +use Monolog\LogRecord; /** * Sends notifications through Slack API * * @author Greg Kedzierski * @see https://api.slack.com/ - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class SlackHandler extends SocketHandler { /** * Slack API token - * @var string */ - private $token; + private string $token; /** * Instance of the SlackRecord util class preparing data for Slack API. - * @var SlackRecord */ - private $slackRecord; + private SlackRecord $slackRecord; /** * @param string $token Slack API token @@ -55,11 +52,11 @@ class SlackHandler extends SocketHandler ?string $username = null, bool $useAttachment = true, ?string $iconEmoji = null, - $level = Logger::CRITICAL, + $level = Level::Critical, bool $bubble = true, bool $useShortAttachment = false, bool $includeContextAndExtra = false, - array $excludeFields = array(), + array $excludeFields = [], bool $persistent = false, float $timeout = 0.0, float $writingTimeout = 10.0, @@ -105,9 +102,9 @@ class SlackHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { $content = $this->buildContent($record); @@ -116,10 +113,8 @@ class SlackHandler extends SocketHandler /** * Builds the body of API call - * - * @phpstan-param FormattedRecord $record */ - private function buildContent(array $record): string + private function buildContent(LogRecord $record): string { $dataArray = $this->prepareContentData($record); @@ -127,15 +122,14 @@ class SlackHandler extends SocketHandler } /** - * @phpstan-param FormattedRecord $record * @return string[] */ - protected function prepareContentData(array $record): array + protected function prepareContentData(LogRecord $record): array { $dataArray = $this->slackRecord->getSlackData($record); $dataArray['token'] = $this->token; - if (!empty($dataArray['attachments'])) { + if (isset($dataArray['attachments']) && is_array($dataArray['attachments']) && \count($dataArray['attachments']) > 0) { $dataArray['attachments'] = Utils::jsonEncode($dataArray['attachments']); } @@ -157,9 +151,9 @@ class SlackHandler extends SocketHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { parent::write($record); $this->finalizeWrite(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php index 8ae3c788..14ed6b1f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php @@ -12,9 +12,10 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; use Monolog\Handler\Slack\SlackRecord; +use Monolog\LogRecord; /** * Sends notifications through Slack Webhooks @@ -26,15 +27,13 @@ class SlackWebhookHandler extends AbstractProcessingHandler { /** * Slack Webhook token - * @var string */ - private $webhookUrl; + private string $webhookUrl; /** * Instance of the SlackRecord util class preparing data for Slack API. - * @var SlackRecord */ - private $slackRecord; + private SlackRecord $slackRecord; /** * @param string $webhookUrl Slack Webhook URL @@ -54,9 +53,9 @@ class SlackWebhookHandler extends AbstractProcessingHandler ?string $iconEmoji = null, bool $useShortAttachment = false, bool $includeContextAndExtra = false, - $level = Logger::CRITICAL, + $level = Level::Critical, bool $bubble = true, - array $excludeFields = array() + array $excludeFields = [] ) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the SlackWebhookHandler'); @@ -88,21 +87,21 @@ class SlackWebhookHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { $postData = $this->slackRecord->getSlackData($record); $postString = Utils::jsonEncode($postData); $ch = curl_init(); - $options = array( + $options = [ CURLOPT_URL => $this->webhookUrl, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, - CURLOPT_HTTPHEADER => array('Content-type: application/json'), + CURLOPT_HTTPHEADER => ['Content-type: application/json'], CURLOPT_POSTFIELDS => $postString, - ); + ]; if (defined('CURLOPT_SAFE_UPLOAD')) { $options[CURLOPT_SAFE_UPLOAD] = true; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php index 21701afa..c5f70888 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php @@ -11,41 +11,29 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * Stores to any socket - uses fsockopen() or pfsockopen(). * * @author Pablo de Leon Belloc * @see http://php.net/manual/en/function.fsockopen.php - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class SocketHandler extends AbstractProcessingHandler { - /** @var string */ - private $connectionString; - /** @var float */ - private $connectionTimeout; + private string $connectionString; + private float $connectionTimeout; /** @var resource|null */ private $resource; - /** @var float */ - private $timeout; - /** @var float */ - private $writingTimeout; - /** @var ?int */ - private $lastSentBytes = null; - /** @var ?int */ - private $chunkSize; - /** @var bool */ - private $persistent; - /** @var ?int */ - private $errno = null; - /** @var ?string */ - private $errstr = null; - /** @var ?float */ - private $lastWritingAt = null; + private float $timeout; + private float $writingTimeout; + private int|null $lastSentBytes = null; + private int|null $chunkSize; + private bool $persistent; + private int|null $errno = null; + private string|null $errstr = null; + private float|null $lastWritingAt = null; /** * @param string $connectionString Socket connection string @@ -56,11 +44,11 @@ class SocketHandler extends AbstractProcessingHandler * established * @param int|null $chunkSize Sets the chunk size. Only has effect during connection in the writing cycle * - * @throws \InvalidArgumentException If an invalid timeout value (less than 0) is passed. + * @throws \InvalidArgumentException If an invalid timeout value (less than 0) is passed. */ public function __construct( string $connectionString, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -87,12 +75,12 @@ class SocketHandler extends AbstractProcessingHandler /** * Connect (if necessary) and write to the socket * - * {@inheritDoc} + * @inheritDoc * * @throws \UnexpectedValueException * @throws \RuntimeException */ - protected function write(array $record): void + protected function write(LogRecord $record): void { $this->connectIfNotConnected(); $data = $this->generateDataStream($record); @@ -213,8 +201,6 @@ class SocketHandler extends AbstractProcessingHandler /** * Get current local writing timeout - * - * @return float */ public function getWritingTimeout(): float { @@ -264,10 +250,8 @@ class SocketHandler extends AbstractProcessingHandler * Wrapper to allow mocking * * @see http://php.net/manual/en/function.stream-set-timeout.php - * - * @return bool */ - protected function streamSetTimeout() + protected function streamSetTimeout(): bool { $seconds = floor($this->timeout); $microseconds = round(($this->timeout - $seconds) * 1e6); @@ -284,9 +268,9 @@ class SocketHandler extends AbstractProcessingHandler * * @see http://php.net/manual/en/function.stream-set-chunk-size.php * - * @return int|bool + * @return int|false */ - protected function streamSetChunkSize() + protected function streamSetChunkSize(): int|bool { if (!is_resource($this->resource)) { throw new \LogicException('streamSetChunkSize called but $this->resource is not a resource'); @@ -302,9 +286,9 @@ class SocketHandler extends AbstractProcessingHandler /** * Wrapper to allow mocking * - * @return int|bool + * @return int|false */ - protected function fwrite(string $data) + protected function fwrite(string $data): int|bool { if (!is_resource($this->resource)) { throw new \LogicException('fwrite called but $this->resource is not a resource'); @@ -318,7 +302,7 @@ class SocketHandler extends AbstractProcessingHandler * * @return mixed[]|bool */ - protected function streamGetMetadata() + protected function streamGetMetadata(): array|bool { if (!is_resource($this->resource)) { throw new \LogicException('streamGetMetadata called but $this->resource is not a resource'); @@ -342,12 +326,9 @@ class SocketHandler extends AbstractProcessingHandler $this->connect(); } - /** - * @phpstan-param FormattedRecord $record - */ - protected function generateDataStream(array $record): string + protected function generateDataStream(LogRecord $record): string { - return (string) $record['formatted']; + return (string) $record->formatted; } /** @@ -387,7 +368,7 @@ class SocketHandler extends AbstractProcessingHandler private function setStreamChunkSize(): void { - if ($this->chunkSize && !$this->streamSetChunkSize()) { + if (null !== $this->chunkSize && false === $this->streamSetChunkSize()) { throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()"); } } @@ -408,7 +389,7 @@ class SocketHandler extends AbstractProcessingHandler } $sent += $chunk; $socketInfo = $this->streamGetMetadata(); - if (is_array($socketInfo) && $socketInfo['timed_out']) { + if (is_array($socketInfo) && (bool) $socketInfo['timed_out']) { throw new \RuntimeException("Write timed-out"); } @@ -437,7 +418,7 @@ class SocketHandler extends AbstractProcessingHandler usleep(100); } - if ((microtime(true) - $this->lastWritingAt) >= $this->writingTimeout) { + if ((microtime(true) - (float) $this->lastWritingAt) >= $this->writingTimeout) { $this->closeSocket(); return true; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php index dcf282b4..b4512a60 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php @@ -12,8 +12,9 @@ namespace Monolog\Handler; use Aws\Sqs\SqsClient; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Writes to any sqs queue. @@ -27,12 +28,10 @@ class SqsHandler extends AbstractProcessingHandler /** 100 KB in bytes - head message size for new error log */ protected const HEAD_MESSAGE_SIZE = 102400; - /** @var SqsClient */ - private $client; - /** @var string */ - private $queueUrl; + private SqsClient $client; + private string $queueUrl; - public function __construct(SqsClient $sqsClient, string $queueUrl, $level = Logger::DEBUG, bool $bubble = true) + public function __construct(SqsClient $sqsClient, string $queueUrl, int|string|Level $level = Level::Debug, bool $bubble = true) { parent::__construct($level, $bubble); @@ -41,15 +40,15 @@ class SqsHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - if (!isset($record['formatted']) || 'string' !== gettype($record['formatted'])) { + if (!isset($record->formatted) || 'string' !== gettype($record->formatted)) { throw new \InvalidArgumentException('SqsHandler accepts only formatted records as a string' . Utils::getRecordMessageForException($record)); } - $messageBody = $record['formatted']; + $messageBody = $record->formatted; if (strlen($messageBody) >= static::MAX_MESSAGE_SIZE) { $messageBody = Utils::substr($messageBody, 0, static::HEAD_MESSAGE_SIZE); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php index 82c048e1..027a7217 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Stores to any stream resource @@ -20,29 +21,21 @@ use Monolog\Utils; * Can be used to store into php://stderr, remote and local files, etc. * * @author Jordi Boggiano - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class StreamHandler extends AbstractProcessingHandler { - /** @const int */ protected const MAX_CHUNK_SIZE = 2147483647; - /** @const int 10MB */ + /** 10MB */ protected const DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024; - /** @var int */ - protected $streamChunkSize; + protected int $streamChunkSize; /** @var resource|null */ protected $stream; - /** @var ?string */ - protected $url = null; - /** @var ?string */ - private $errorMessage = null; - /** @var ?int */ - protected $filePermission; - /** @var bool */ - protected $useLocking; + protected string|null $url = null; + private string|null $errorMessage = null; + protected int|null $filePermission; + protected bool $useLocking; /** @var true|null */ - private $dirCreated = null; + private bool|null $dirCreated = null; /** * @param resource|string $stream If a missing path can't be created, an UnexpectedValueException will be thrown on first write @@ -51,7 +44,7 @@ class StreamHandler extends AbstractProcessingHandler * * @throws \InvalidArgumentException If stream is not a resource or string */ - public function __construct($stream, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) + public function __construct($stream, int|string|Level $level = Level::Debug, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) { parent::__construct($level, $bubble); @@ -83,11 +76,11 @@ class StreamHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { - if ($this->url && is_resource($this->stream)) { + if (null !== $this->url && is_resource($this->stream)) { fclose($this->stream); } $this->stream = null; @@ -106,26 +99,21 @@ class StreamHandler extends AbstractProcessingHandler /** * Return the stream URL if it was configured with a URL and not an active resource - * - * @return string|null */ public function getUrl(): ?string { return $this->url; } - /** - * @return int - */ public function getStreamChunkSize(): int { return $this->streamChunkSize; } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { if (!is_resource($this->stream)) { $url = $this->url; @@ -135,14 +123,11 @@ class StreamHandler extends AbstractProcessingHandler $this->createDir($url); $this->errorMessage = null; set_error_handler([$this, 'customErrorHandler']); - try { - $stream = fopen($url, 'a'); - if ($this->filePermission !== null) { - @chmod($url, $this->filePermission); - } - } finally { - restore_error_handler(); + $stream = fopen($url, 'a'); + if ($this->filePermission !== null) { + @chmod($url, $this->filePermission); } + restore_error_handler(); if (!is_resource($stream)) { $this->stream = null; @@ -153,10 +138,6 @@ class StreamHandler extends AbstractProcessingHandler } $stream = $this->stream; - if (!is_resource($stream)) { - throw new \LogicException('No stream was opened yet' . Utils::getRecordMessageForException($record)); - } - if ($this->useLocking) { // ignoring errors here, there's not much we can do about them flock($stream, LOCK_EX); @@ -172,13 +153,10 @@ class StreamHandler extends AbstractProcessingHandler /** * Write to stream * @param resource $stream - * @param array $record - * - * @phpstan-param FormattedRecord $record */ - protected function streamWrite($stream, array $record): void + protected function streamWrite($stream, LogRecord $record): void { - fwrite($stream, (string) $record['formatted']); + fwrite($stream, (string) $record->formatted); } private function customErrorHandler(int $code, string $msg): bool @@ -205,7 +183,7 @@ class StreamHandler extends AbstractProcessingHandler private function createDir(string $url): void { // Do not try to create dir if it has already been tried. - if ($this->dirCreated) { + if (true === $this->dirCreated) { return; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php deleted file mode 100644 index fae92514..00000000 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * 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; - } -} diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php index 130e6f1f..842b6577 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php @@ -11,7 +11,10 @@ namespace Monolog\Handler; +use Closure; +use Monolog\Level; use Monolog\Logger; +use Monolog\LogRecord; use Monolog\Utils; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; @@ -23,23 +26,20 @@ use Symfony\Component\Mime\Email; * SymfonyMailerHandler uses Symfony's Mailer component to send the emails * * @author Jordi Boggiano - * - * @phpstan-import-type Record from \Monolog\Logger */ class SymfonyMailerHandler extends MailHandler { - /** @var MailerInterface|TransportInterface */ - protected $mailer; - /** @var Email|callable(string, Record[]): Email */ - private $emailTemplate; + protected MailerInterface|TransportInterface $mailer; + /** @var Email|Closure(string, LogRecord[]): Email */ + private Email|Closure $emailTemplate; /** - * @psalm-param Email|callable(string, Record[]): Email $email + * @phpstan-param Email|Closure(string, LogRecord[]): Email $email * * @param MailerInterface|TransportInterface $mailer The mailer to use - * @param callable|Email $email An email template, the subject/body will be replaced + * @param Closure|Email $email An email template, the subject/body will be replaced */ - public function __construct($mailer, $email, $level = Logger::ERROR, bool $bubble = true) + public function __construct($mailer, Email|Closure $email, int|string|Level $level = Level::Error, bool $bubble = true) { parent::__construct($level, $bubble); @@ -68,10 +68,8 @@ class SymfonyMailerHandler extends MailHandler /** * Creates instance of Email to be sent * - * @param string $content formatted email body to be sent - * @param array $records Log records that formed the content - * - * @phpstan-param Record[] $records + * @param string $content formatted email body to be sent + * @param LogRecord[] $records Log records that formed the content */ protected function buildMessage(string $content, array $records): Email { @@ -84,10 +82,10 @@ class SymfonyMailerHandler extends MailHandler if (!$message instanceof Email) { $record = reset($records); - throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it' . ($record ? Utils::getRecordMessageForException($record) : '')); + throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it' . ($record instanceof LogRecord ? Utils::getRecordMessageForException($record) : '')); } - if ($records) { + if (\count($records) > 0) { $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); $message->subject($subjectFormatter->format($this->getHighestRecord($records))); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php index 1d543b7e..0816a011 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php @@ -11,8 +11,9 @@ namespace Monolog\Handler; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Logs to syslog service. @@ -29,17 +30,14 @@ use Monolog\Utils; */ class SyslogHandler extends AbstractSyslogHandler { - /** @var string */ - protected $ident; - /** @var int */ - protected $logopts; + protected string $ident; + protected int $logopts; /** - * @param string $ident * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID */ - public function __construct(string $ident, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, int $logopts = LOG_PID) + public function __construct(string $ident, string|int $facility = LOG_USER, int|string|Level $level = Level::Debug, bool $bubble = true, int $logopts = LOG_PID) { parent::__construct($facility, $level, $bubble); @@ -48,7 +46,7 @@ class SyslogHandler extends AbstractSyslogHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function close(): void { @@ -56,13 +54,13 @@ class SyslogHandler extends AbstractSyslogHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { if (!openlog($this->ident, $this->logopts, $this->facility)) { throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"' . Utils::getRecordMessageForException($record)); } - syslog($this->logLevels[$record['level']], (string) $record['formatted']); + syslog($this->toSyslogPriority($record->level), (string) $record->formatted); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php index dbd8ef69..6a483345 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php @@ -18,12 +18,9 @@ class UdpSocket { protected const DATAGRAM_MAX_LENGTH = 65023; - /** @var string */ - protected $ip; - /** @var int */ - protected $port; - /** @var resource|Socket|null */ - protected $socket = null; + protected string $ip; + protected int $port; + protected ?Socket $socket = null; public function __construct(string $ip, int $port = 514) { @@ -31,28 +28,20 @@ class UdpSocket $this->port = $port; } - /** - * @param string $line - * @param string $header - * @return void - */ - public function write($line, $header = "") + public function write(string $line, string $header = ""): void { $this->send($this->assembleMessage($line, $header)); } public function close(): void { - if (is_resource($this->socket) || $this->socket instanceof Socket) { + if ($this->socket instanceof Socket) { socket_close($this->socket); $this->socket = null; } } - /** - * @return resource|Socket - */ - protected function getSocket() + protected function getSocket(): Socket { if (null !== $this->socket) { return $this->socket; @@ -66,12 +55,12 @@ class UdpSocket $protocol = IPPROTO_IP; } - $this->socket = socket_create($domain, SOCK_DGRAM, $protocol) ?: null; - if (null === $this->socket) { - throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' could not be opened via socket_create'); + $socket = socket_create($domain, SOCK_DGRAM, $protocol); + if ($socket instanceof Socket) { + return $this->socket = $socket; } - return $this->socket; + throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' could not be opened via socket_create'); } protected function send(string $chunk): void diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php index deaa19f8..abb8be9b 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php @@ -12,8 +12,9 @@ namespace Monolog\Handler; use DateTimeInterface; -use Monolog\Logger; use Monolog\Handler\SyslogUdp\UdpSocket; +use Monolog\Level; +use Monolog\LogRecord; use Monolog\Utils; /** @@ -29,31 +30,29 @@ class SyslogUdpHandler extends AbstractSyslogHandler const RFC5424e = 2; /** @var array */ - private $dateFormats = array( + private array $dateFormats = [ self::RFC3164 => 'M d H:i:s', self::RFC5424 => \DateTime::RFC3339, self::RFC5424e => \DateTime::RFC3339_EXTENDED, - ); + ]; - /** @var UdpSocket */ - protected $socket; - /** @var string */ - protected $ident; + protected UdpSocket $socket; + protected string $ident; /** @var self::RFC* */ - protected $rfc; + protected int $rfc; /** - * @param string $host Either IP/hostname or a path to a unix socket (port must be 0 then) - * @param int $port Port number, or 0 if $host is a unix socket - * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param string $ident Program name or tag for each log message. - * @param int $rfc RFC to format the message for. + * @param string $host Either IP/hostname or a path to a unix socket (port must be 0 then) + * @param int $port Port number, or 0 if $host is a unix socket + * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $ident Program name or tag for each log message. + * @param int $rfc RFC to format the message for. * @throws MissingExtensionException * * @phpstan-param self::RFC* $rfc */ - public function __construct(string $host, int $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, string $ident = 'php', int $rfc = self::RFC5424) + public function __construct(string $host, int $port = 514, string|int $facility = LOG_USER, int|string|Level $level = Level::Debug, bool $bubble = true, string $ident = 'php', int $rfc = self::RFC5424) { if (!extension_loaded('sockets')) { throw new MissingExtensionException('The sockets extension is required to use the SyslogUdpHandler'); @@ -67,11 +66,11 @@ class SyslogUdpHandler extends AbstractSyslogHandler $this->socket = new UdpSocket($host, $port); } - protected function write(array $record): void + protected function write(LogRecord $record): void { - $lines = $this->splitMessageIntoLines($record['formatted']); + $lines = $this->splitMessageIntoLines($record->formatted); - $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']], $record['datetime']); + $header = $this->makeCommonSyslogHeader($this->toSyslogPriority($record->level), $record->datetime); foreach ($lines as $line) { $this->socket->write($line, $header); @@ -96,6 +95,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler $lines = preg_split('/$\R?^/m', (string) $message, -1, PREG_SPLIT_NO_EMPTY); if (false === $lines) { $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Could not preg_split: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); } @@ -109,11 +109,13 @@ class SyslogUdpHandler extends AbstractSyslogHandler { $priority = $severity + $this->facility; - if (!$pid = getmypid()) { + $pid = getmypid(); + if (false === $pid) { $pid = '-'; } - if (!$hostname = gethostname()) { + $hostname = gethostname(); + if (false === $hostname) { $hostname = '-'; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php index 8912eba5..2e1be9f6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php @@ -12,8 +12,9 @@ namespace Monolog\Handler; use RuntimeException; -use Monolog\Logger; +use Monolog\Level; use Monolog\Utils; +use Monolog\LogRecord; /** * Handler send logs to Telegram using Telegram Bot API. @@ -28,8 +29,6 @@ use Monolog\Utils; * @link https://core.telegram.org/bots/api * * @author Mazur Alexandr - * - * @phpstan-import-type Record from \Monolog\Logger */ class TelegramBotHandler extends AbstractProcessingHandler { @@ -52,69 +51,61 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * Telegram bot access token provided by BotFather. * Create telegram bot with https://telegram.me/BotFather and use access token from it. - * @var string */ - private $apiKey; + private string $apiKey; /** * Telegram channel name. * Since to start with '@' symbol as prefix. - * @var string */ - private $channel; + private string $channel; /** * The kind of formatting that is used for the message. * See available options at https://core.telegram.org/bots/api#formatting-options * or in AVAILABLE_PARSE_MODES - * @var ?string */ - private $parseMode; + private string|null $parseMode; /** * Disables link previews for links in the message. - * @var ?bool */ - private $disableWebPagePreview; + private bool|null $disableWebPagePreview; /** * Sends the message silently. Users will receive a notification with no sound. - * @var ?bool */ - private $disableNotification; + private bool|null $disableNotification; /** * True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages. * False - truncates a message that is too long. - * @var bool */ - private $splitLongMessages; + private bool $splitLongMessages; /** * Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests). - * @var bool */ - private $delayBetweenMessages; + private bool $delayBetweenMessages; /** - * @param string $apiKey Telegram bot access token provided by BotFather - * @param string $channel Telegram channel name - * @param bool $splitLongMessages Split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages - * @param bool $delayBetweenMessages Adds delay between sending a split message according to Telegram API + * @param string $apiKey Telegram bot access token provided by BotFather + * @param string $channel Telegram channel name + * @param bool $splitLongMessages Split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages + * @param bool $delayBetweenMessages Adds delay between sending a split message according to Telegram API * @throws MissingExtensionException */ public function __construct( string $apiKey, string $channel, - $level = Logger::DEBUG, + $level = Level::Debug, bool $bubble = true, string $parseMode = null, bool $disableWebPagePreview = null, bool $disableNotification = null, bool $splitLongMessages = false, bool $delayBetweenMessages = false - ) - { + ) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the TelegramBotHandler'); } @@ -132,7 +123,7 @@ class TelegramBotHandler extends AbstractProcessingHandler public function setParseMode(string $parseMode = null): self { - if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES)) { + if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES, true)) { throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.'); } @@ -158,7 +149,6 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages. * False - truncates a message that is too long. - * @param bool $splitLongMessages * @return $this */ public function splitLongMessages(bool $splitLongMessages = false): self @@ -170,7 +160,6 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests). - * @param bool $delayBetweenMessages * @return $this */ public function delayBetweenMessages(bool $delayBetweenMessages = false): self @@ -181,11 +170,10 @@ class TelegramBotHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { - /** @var Record[] $messages */ $messages = []; foreach ($records as $record) { @@ -193,30 +181,28 @@ class TelegramBotHandler extends AbstractProcessingHandler continue; } - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } $messages[] = $record; } - if (!empty($messages)) { - $this->send((string)$this->getFormatter()->formatBatch($messages)); + if (\count($messages) > 0) { + $this->send((string) $this->getFormatter()->formatBatch($messages)); } } /** * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->send($record['formatted']); + $this->send($record->formatted); } /** * Send request to @link https://api.telegram.org/bot on SendMessage action. - * @param string $message */ protected function send(string $message): void { @@ -259,7 +245,6 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * Handle a message that is too long: truncates or splits into several - * @param string $message * @return string[] */ private function handleMessageLength(string $message): array diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php index 0986da27..1884f83f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php @@ -11,8 +11,10 @@ namespace Monolog\Handler; +use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Used for testing purposes. @@ -65,85 +67,67 @@ use Psr\Log\LogLevel; * @method bool hasNoticeThatPasses($message) * @method bool hasInfoThatPasses($message) * @method bool hasDebugThatPasses($message) - * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class TestHandler extends AbstractProcessingHandler { - /** @var Record[] */ - protected $records = []; - /** @var array */ - protected $recordsByLevel = []; - /** @var bool */ - private $skipReset = false; + /** @var LogRecord[] */ + protected array $records = []; + /** @phpstan-var array, LogRecord[]> */ + protected array $recordsByLevel = []; + private bool $skipReset = false; /** - * @return array - * - * @phpstan-return Record[] + * @return array */ - public function getRecords() + public function getRecords(): array { return $this->records; } - /** - * @return void - */ - public function clear() + public function clear(): void { $this->records = []; $this->recordsByLevel = []; } - /** - * @return void - */ - public function reset() + public function reset(): void { if (!$this->skipReset) { $this->clear(); } } - /** - * @return void - */ - public function setSkipReset(bool $skipReset) + public function setSkipReset(bool $skipReset): void { $this->skipReset = $skipReset; } /** - * @param string|int $level Logging level value or name + * @param int|string|Level|LogLevel::* $level Logging level value or name * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function hasRecords($level): bool + public function hasRecords(int|string|Level $level): bool { - return isset($this->recordsByLevel[Logger::toMonologLevel($level)]); + return isset($this->recordsByLevel[Logger::toMonologLevel($level)->value]); } /** - * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records - * @param string|int $level Logging level value or name + * @param string|array $recordAssertions Either a message string or an array containing message and optionally context keys that will be checked against all records * - * @phpstan-param array{message: string, context?: mixed[]}|string $record - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param array{message: string, context?: mixed[]}|string $recordAssertions */ - public function hasRecord($record, $level): bool + public function hasRecord(string|array $recordAssertions, Level $level): bool { - if (is_string($record)) { - $record = array('message' => $record); + if (is_string($recordAssertions)) { + $recordAssertions = ['message' => $recordAssertions]; } - return $this->hasRecordThatPasses(function ($rec) use ($record) { - if ($rec['message'] !== $record['message']) { + return $this->hasRecordThatPasses(function (LogRecord $rec) use ($recordAssertions) { + if ($rec->message !== $recordAssertions['message']) { return false; } - if (isset($record['context']) && $rec['context'] !== $record['context']) { + if (isset($recordAssertions['context']) && $rec->context !== $recordAssertions['context']) { return false; } @@ -151,47 +135,29 @@ class TestHandler extends AbstractProcessingHandler }, $level); } - /** - * @param string|int $level Logging level value or name - * - * @phpstan-param Level|LevelName|LogLevel::* $level - */ - public function hasRecordThatContains(string $message, $level): bool + public function hasRecordThatContains(string $message, Level $level): bool { - return $this->hasRecordThatPasses(function ($rec) use ($message) { - return strpos($rec['message'], $message) !== false; - }, $level); + return $this->hasRecordThatPasses(fn (LogRecord $rec) => str_contains($rec->message, $message), $level); + } + + public function hasRecordThatMatches(string $regex, Level $level): bool + { + return $this->hasRecordThatPasses(fn (LogRecord $rec) => preg_match($regex, $rec->message) > 0, $level); } /** - * @param string|int $level Logging level value or name - * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param callable(LogRecord, int): mixed $predicate */ - public function hasRecordThatMatches(string $regex, $level): bool - { - return $this->hasRecordThatPasses(function (array $rec) use ($regex): bool { - return preg_match($regex, $rec['message']) > 0; - }, $level); - } - - /** - * @param string|int $level Logging level value or name - * @return bool - * - * @psalm-param callable(Record, int): mixed $predicate - * @phpstan-param Level|LevelName|LogLevel::* $level - */ - public function hasRecordThatPasses(callable $predicate, $level) + public function hasRecordThatPasses(callable $predicate, Level $level): bool { $level = Logger::toMonologLevel($level); - if (!isset($this->recordsByLevel[$level])) { + if (!isset($this->recordsByLevel[$level->value])) { return false; } - foreach ($this->recordsByLevel[$level] as $i => $rec) { - if ($predicate($rec, $i)) { + foreach ($this->recordsByLevel[$level->value] as $i => $rec) { + if ((bool) $predicate($rec, $i)) { return true; } } @@ -200,24 +166,22 @@ class TestHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ - protected function write(array $record): void + protected function write(LogRecord $record): void { - $this->recordsByLevel[$record['level']][] = $record; + $this->recordsByLevel[$record->level->value][] = $record; $this->records[] = $record; } /** - * @param string $method - * @param mixed[] $args - * @return bool + * @param mixed[] $args */ - public function __call($method, $args) + public function __call(string $method, array $args): bool { if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; - $level = constant('Monolog\Logger::' . strtoupper($matches[2])); + $level = constant(Level::class.'::' . $matches[2]); $callback = [$this, $genericMethod]; if (is_callable($callback)) { $args[] = $level; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php index c8183528..9c12c3d5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php @@ -15,7 +15,6 @@ trait WebRequestRecognizerTrait { /** * Checks if PHP's serving a web request - * @return bool */ protected function isWebRequest(): bool { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php index b6d3d3b1..2dbc5fe8 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php @@ -11,30 +11,30 @@ namespace Monolog\Handler; +use Monolog\LogRecord; +use Throwable; + /** * Forwards records to multiple handlers suppressing failures of each handler * and continuing through to give every handler a chance to succeed. * * @author Craig D'Amelio - * - * @phpstan-import-type Record from \Monolog\Logger */ class WhatFailureGroupHandler extends GroupHandler { /** - * {@inheritDoc} + * @inheritDoc */ - public function handle(array $record): bool + public function handle(LogRecord $record): bool { - if ($this->processors) { - /** @var Record $record */ + if (\count($this->processors) > 0) { $record = $this->processRecord($record); } foreach ($this->handlers as $handler) { try { $handler->handle($record); - } catch (\Throwable $e) { + } catch (Throwable) { // What failure? } } @@ -43,37 +43,22 @@ class WhatFailureGroupHandler extends GroupHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function handleBatch(array $records): void { - if ($this->processors) { - $processed = array(); + if (\count($this->processors) > 0) { + $processed = []; foreach ($records as $record) { $processed[] = $this->processRecord($record); } - /** @var Record[] $records */ $records = $processed; } foreach ($this->handlers as $handler) { try { $handler->handleBatch($records); - } catch (\Throwable $e) { - // What failure? - } - } - } - - /** - * {@inheritDoc} - */ - public function close(): void - { - foreach ($this->handlers as $handler) { - try { - $handler->close(); - } catch (\Throwable $e) { + } catch (Throwable) { // What failure? } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php index ddd46d8c..1e71194b 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php @@ -13,70 +13,67 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\NormalizerFormatter; -use Monolog\Logger; +use Monolog\Level; +use Monolog\LogRecord; /** * Handler sending logs to Zend Monitor * * @author Christian Bergau * @author Jason Davis - * - * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class ZendMonitorHandler extends AbstractProcessingHandler { - /** - * Monolog level / ZendMonitor Custom Event priority map - * - * @var array - */ - protected $levelMap = []; - /** * @throws MissingExtensionException */ - public function __construct($level = Logger::DEBUG, bool $bubble = true) + public function __construct(int|string|Level $level = Level::Debug, bool $bubble = true) { if (!function_exists('zend_monitor_custom_event')) { throw new MissingExtensionException( 'You must have Zend Server installed with Zend Monitor enabled in order to use this handler' ); } - //zend monitor constants are not defined if zend monitor is not enabled. - $this->levelMap = [ - Logger::DEBUG => \ZEND_MONITOR_EVENT_SEVERITY_INFO, - Logger::INFO => \ZEND_MONITOR_EVENT_SEVERITY_INFO, - Logger::NOTICE => \ZEND_MONITOR_EVENT_SEVERITY_INFO, - Logger::WARNING => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, - Logger::ERROR => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - Logger::CRITICAL => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - Logger::ALERT => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - Logger::EMERGENCY => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - ]; + parent::__construct($level, $bubble); } /** - * {@inheritDoc} + * Translates Monolog log levels to ZendMonitor levels. */ - protected function write(array $record): void + protected function toZendMonitorLevel(Level $level): int + { + return match ($level) { + Level::Debug => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Level::Info => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Level::Notice => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Level::Warning => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, + Level::Error => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Level::Critical => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Level::Alert => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Level::Emergency => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + }; + } + + /** + * @inheritDoc + */ + protected function write(LogRecord $record): void { $this->writeZendMonitorCustomEvent( - Logger::getLevelName($record['level']), - $record['message'], - $record['formatted'], - $this->levelMap[$record['level']] + $record->level->getName(), + $record->message, + $record->formatted, + $this->toZendMonitorLevel($record->level) ); } /** * Write to Zend Monitor Events - * @param string $type Text displayed in "Class Name (custom)" field - * @param string $message Text displayed in "Error String" - * @param array $formatted Displayed in Custom Variables tab - * @param int $severity Set the event severity level (-1,0,1) - * - * @phpstan-param FormattedRecord $formatted + * @param string $type Text displayed in "Class Name (custom)" field + * @param string $message Text displayed in "Error String" + * @param array $formatted Displayed in Custom Variables tab + * @param int $severity Set the event severity level (-1,0,1) */ protected function writeZendMonitorCustomEvent(string $type, string $message, array $formatted, int $severity): void { @@ -84,18 +81,10 @@ class ZendMonitorHandler extends AbstractProcessingHandler } /** - * {@inheritDoc} + * @inheritDoc */ public function getDefaultFormatter(): FormatterInterface { return new NormalizerFormatter(); } - - /** - * @return array - */ - public function getLevelMap(): array - { - return $this->levelMap; - } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Level.php b/monolog/vendor/monolog/monolog/src/Monolog/Level.php new file mode 100644 index 00000000..ab04cf4d --- /dev/null +++ b/monolog/vendor/monolog/monolog/src/Monolog/Level.php @@ -0,0 +1,209 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Psr\Log\LogLevel; + +/** + * Represents the log levels + * + * Monolog supports the logging levels described by RFC 5424 {@see https://datatracker.ietf.org/doc/html/rfc5424} + * but due to BC the severity values used internally are not 0-7. + * + * To get the level name out of a Level there are three options: + * + * - Use ->getName() to get the standard Monolog name which is full uppercased (e.g. "DEBUG") + * - Use ->toPsrLogLevel() to get the standard PSR-3 name which is full lowercased (e.g. "debug") + * - Use ->toRFC5424Level() to get the standard RFC 5424 value (e.g. 7 for debug, 0 for emergency) + * - Use ->name to get the enum case's name which is capitalized (e.g. "Debug") + * + * To get the value for filtering, if the includes/isLowerThan/isHigherThan methods are + * not enough, you can use ->value to get the enum case's integer value. + */ +enum Level: int +{ + /** + * Detailed debug information + */ + case Debug = 100; + + /** + * Interesting events + * + * Examples: User logs in, SQL logs. + */ + case Info = 200; + + /** + * Uncommon events + */ + case Notice = 250; + + /** + * Exceptional occurrences that are not errors + * + * Examples: Use of deprecated APIs, poor use of an API, + * undesirable things that are not necessarily wrong. + */ + case Warning = 300; + + /** + * Runtime errors + */ + case Error = 400; + + /** + * Critical conditions + * + * Example: Application component unavailable, unexpected exception. + */ + case Critical = 500; + + /** + * Action must be taken immediately + * + * Example: Entire website down, database unavailable, etc. + * This should trigger the SMS alerts and wake you up. + */ + case Alert = 550; + + /** + * Urgent alert. + */ + case Emergency = 600; + + /** + * @param value-of|LogLevel::*|'Debug'|'Info'|'Notice'|'Warning'|'Error'|'Critical'|'Alert'|'Emergency' $name + * @return static + */ + public static function fromName(string $name): self + { + return match ($name) { + 'debug', 'Debug', 'DEBUG' => self::Debug, + 'info', 'Info', 'INFO' => self::Info, + 'notice', 'Notice', 'NOTICE' => self::Notice, + 'warning', 'Warning', 'WARNING' => self::Warning, + 'error', 'Error', 'ERROR' => self::Error, + 'critical', 'Critical', 'CRITICAL' => self::Critical, + 'alert', 'Alert', 'ALERT' => self::Alert, + 'emergency', 'Emergency', 'EMERGENCY' => self::Emergency, + }; + } + + /** + * @param value-of $value + * @return static + */ + public static function fromValue(int $value): self + { + return self::from($value); + } + + /** + * Returns true if the passed $level is higher or equal to $this + */ + public function includes(Level $level): bool + { + return $this->value <= $level->value; + } + + public function isHigherThan(Level $level): bool + { + return $this->value > $level->value; + } + + public function isLowerThan(Level $level): bool + { + return $this->value < $level->value; + } + + /** + * Returns the monolog standardized all-capitals name of the level + * + * Use this instead of $level->name which returns the enum case name (e.g. Debug vs DEBUG if you use getName()) + * + * @return value-of + */ + public function getName(): string + { + return match ($this) { + self::Debug => 'DEBUG', + self::Info => 'INFO', + self::Notice => 'NOTICE', + self::Warning => 'WARNING', + self::Error => 'ERROR', + self::Critical => 'CRITICAL', + self::Alert => 'ALERT', + self::Emergency => 'EMERGENCY', + }; + } + + /** + * Returns the PSR-3 level matching this instance + * + * @phpstan-return \Psr\Log\LogLevel::* + */ + public function toPsrLogLevel(): string + { + return match ($this) { + self::Debug => LogLevel::DEBUG, + self::Info => LogLevel::INFO, + self::Notice => LogLevel::NOTICE, + self::Warning => LogLevel::WARNING, + self::Error => LogLevel::ERROR, + self::Critical => LogLevel::CRITICAL, + self::Alert => LogLevel::ALERT, + self::Emergency => LogLevel::EMERGENCY, + }; + } + + /** + * Returns the RFC 5424 level matching this instance + * + * @phpstan-return int<0, 7> + */ + public function toRFC5424Level(): int + { + return match ($this) { + self::Debug => 7, + self::Info => 6, + self::Notice => 5, + self::Warning => 4, + self::Error => 3, + self::Critical => 2, + self::Alert => 1, + self::Emergency => 0, + }; + } + + public const VALUES = [ + 100, + 200, + 250, + 300, + 400, + 500, + 550, + 600, + ]; + + public const NAMES = [ + 'DEBUG', + 'INFO', + 'NOTICE', + 'WARNING', + 'ERROR', + 'CRITICAL', + 'ALERT', + 'EMERGENCY', + ]; +} diff --git a/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php b/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php index 702807d7..df758c58 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php @@ -14,21 +14,111 @@ namespace Monolog; use ArrayAccess; /** - * Monolog log record interface for forward compatibility with Monolog 3.0 - * - * This is just present in Monolog 2.4+ to allow interoperable code to be written against - * both versions by type-hinting arguments as `array|\Monolog\LogRecord $record` - * - * Do not rely on this interface for other purposes, and do not implement it. + * Monolog log record * * @author Jordi Boggiano - * @template-extends \ArrayAccess<'message'|'level'|'context'|'level_name'|'channel'|'datetime'|'extra'|'formatted', mixed> - * @phpstan-import-type Record from Logger + * @template-implements ArrayAccess<'message'|'level'|'context'|'level_name'|'channel'|'datetime'|'extra', int|string|\DateTimeImmutable|array> */ -interface LogRecord extends \ArrayAccess +class LogRecord implements ArrayAccess { + private const MODIFIABLE_FIELDS = [ + 'extra' => true, + 'formatted' => true, + ]; + + public function __construct( + public readonly \DateTimeImmutable $datetime, + public readonly string $channel, + public readonly Level $level, + public readonly string $message, + /** @var array */ + public readonly array $context = [], + /** @var array */ + public array $extra = [], + public mixed $formatted = null, + ) { + } + + public function offsetSet(mixed $offset, mixed $value): void + { + if ($offset === 'extra') { + if (!is_array($value)) { + throw new \InvalidArgumentException('extra must be an array'); + } + + $this->extra = $value; + + return; + } + + if ($offset === 'formatted') { + $this->formatted = $value; + + return; + } + + throw new \LogicException('Unsupported operation: setting '.$offset); + } + + public function offsetExists(mixed $offset): bool + { + if ($offset === 'level_name') { + return true; + } + + return isset($this->{$offset}); + } + + public function offsetUnset(mixed $offset): void + { + throw new \LogicException('Unsupported operation'); + } + + public function &offsetGet(mixed $offset): mixed + { + if ($offset === 'level_name' || $offset === 'level') { + // avoid returning readonly props by ref as this is illegal + if ($offset === 'level_name') { + $copy = $this->level->getName(); + } else { + $copy = $this->level->value; + } + + return $copy; + } + + if (isset(self::MODIFIABLE_FIELDS[$offset])) { + return $this->{$offset}; + } + + // avoid returning readonly props by ref as this is illegal + $copy = $this->{$offset}; + + return $copy; + } + /** - * @phpstan-return Record + * @phpstan-return array{message: string, context: mixed[], level: value-of, level_name: value-of, channel: string, datetime: \DateTimeImmutable, extra: mixed[]} */ - public function toArray(): array; + public function toArray(): array + { + return [ + 'message' => $this->message, + 'context' => $this->context, + 'level' => $this->level->value, + 'level_name' => $this->level->getName(), + 'channel' => $this->channel, + 'datetime' => $this->datetime, + 'extra' => $this->extra, + ]; + } + + public function with(mixed ...$args): self + { + foreach (['message', 'context', 'level', 'channel', 'datetime', 'extra'] as $prop) { + $args[$prop] ??= $this->{$prop}; + } + + return new self(...$args); + } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Logger.php b/monolog/vendor/monolog/monolog/src/Monolog/Logger.php index 84a2f551..5aacc6f8 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Logger.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Logger.php @@ -11,8 +11,10 @@ namespace Monolog; +use Closure; use DateTimeZone; use Monolog\Handler\HandlerInterface; +use Monolog\Processor\ProcessorInterface; use Psr\Log\LoggerInterface; use Psr\Log\InvalidArgumentException; use Psr\Log\LogLevel; @@ -26,15 +28,14 @@ use Stringable; * and uses them to store records that are added to it. * * @author Jordi Boggiano - * - * @phpstan-type Level Logger::DEBUG|Logger::INFO|Logger::NOTICE|Logger::WARNING|Logger::ERROR|Logger::CRITICAL|Logger::ALERT|Logger::EMERGENCY - * @phpstan-type LevelName 'DEBUG'|'INFO'|'NOTICE'|'WARNING'|'ERROR'|'CRITICAL'|'ALERT'|'EMERGENCY' - * @phpstan-type Record array{message: string, context: mixed[], level: Level, level_name: LevelName, channel: string, datetime: \DateTimeImmutable, extra: mixed[]} + * @final */ class Logger implements LoggerInterface, ResettableInterface { /** * Detailed debug information + * + * @deprecated Use \Monolog\Level::Debug */ public const DEBUG = 100; @@ -42,11 +43,15 @@ class Logger implements LoggerInterface, ResettableInterface * Interesting events * * Examples: User logs in, SQL logs. + * + * @deprecated Use \Monolog\Level::Info */ public const INFO = 200; /** * Uncommon events + * + * @deprecated Use \Monolog\Level::Notice */ public const NOTICE = 250; @@ -55,11 +60,15 @@ class Logger implements LoggerInterface, ResettableInterface * * Examples: Use of deprecated APIs, poor use of an API, * undesirable things that are not necessarily wrong. + * + * @deprecated Use \Monolog\Level::Warning */ public const WARNING = 300; /** * Runtime errors + * + * @deprecated Use \Monolog\Level::Error */ public const ERROR = 400; @@ -67,6 +76,8 @@ class Logger implements LoggerInterface, ResettableInterface * Critical conditions * * Example: Application component unavailable, unexpected exception. + * + * @deprecated Use \Monolog\Level::Critical */ public const CRITICAL = 500; @@ -75,11 +86,15 @@ class Logger implements LoggerInterface, ResettableInterface * * Example: Entire website down, database unavailable, etc. * This should trigger the SMS alerts and wake you up. + * + * @deprecated Use \Monolog\Level::Alert */ public const ALERT = 550; /** * Urgent alert. + * + * @deprecated Use \Monolog\Level::Emergency */ public const EMERGENCY = 600; @@ -88,28 +103,8 @@ class Logger implements LoggerInterface, ResettableInterface * * This is only bumped when API breaks are done and should * follow the major version of the library - * - * @var int */ - public const API = 2; - - /** - * This is a static variable and not a constant to serve as an extension point for custom levels - * - * @var array $levels Logging levels with the levels as key - * - * @phpstan-var array $levels Logging levels with the levels as key - */ - protected static $levels = [ - self::DEBUG => 'DEBUG', - self::INFO => 'INFO', - self::NOTICE => 'NOTICE', - self::WARNING => 'WARNING', - self::ERROR => 'ERROR', - self::CRITICAL => 'CRITICAL', - self::ALERT => 'ALERT', - self::EMERGENCY => 'EMERGENCY', - ]; + public const API = 3; /** * Mapping between levels numbers defined in RFC 5424 and Monolog ones @@ -117,90 +112,66 @@ class Logger implements LoggerInterface, ResettableInterface * @phpstan-var array $rfc_5424_levels */ private const RFC_5424_LEVELS = [ - 7 => self::DEBUG, - 6 => self::INFO, - 5 => self::NOTICE, - 4 => self::WARNING, - 3 => self::ERROR, - 2 => self::CRITICAL, - 1 => self::ALERT, - 0 => self::EMERGENCY, + 7 => Level::Debug, + 6 => Level::Info, + 5 => Level::Notice, + 4 => Level::Warning, + 3 => Level::Error, + 2 => Level::Critical, + 1 => Level::Alert, + 0 => Level::Emergency, ]; - /** - * @var string - */ - protected $name; + protected string $name; /** * The handler stack * - * @var HandlerInterface[] + * @var list */ - protected $handlers; + protected array $handlers; /** * Processors that will process all log records * * To process records of a single handler instead, add the processor on that specific handler * - * @var callable[] + * @var array<(callable(LogRecord): LogRecord)|ProcessorInterface> */ - protected $processors; + protected array $processors; + + protected bool $microsecondTimestamps = true; + + protected DateTimeZone $timezone; + + protected Closure|null $exceptionHandler = null; /** - * @var bool + * Keeps track of depth to prevent infinite logging loops */ - protected $microsecondTimestamps = true; + private int $logDepth = 0; /** - * @var DateTimeZone - */ - protected $timezone; - - /** - * @var callable|null - */ - protected $exceptionHandler; - - /** - * @var int Keeps track of depth to prevent infinite logging loops - */ - private $logDepth = 0; - - /** - * @var \WeakMap<\Fiber, int>|null Keeps track of depth inside fibers to prevent infinite logging loops - */ - private $fiberLogDepth; - - /** - * @var bool Whether to detect infinite logging loops + * Whether to detect infinite logging loops * * This can be disabled via {@see useLoggingLoopDetection} if you have async handlers that do not play well with this */ - private $detectCycles = true; + private bool $detectCycles = true; /** - * @psalm-param array $processors - * * @param string $name The logging channel, a simple descriptive name that is attached to all log records * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. * @param callable[] $processors Optional array of processors * @param DateTimeZone|null $timezone Optional timezone, if not provided date_default_timezone_get() will be used + * + * @phpstan-param array<(callable(LogRecord): LogRecord)|ProcessorInterface> $processors */ - public function __construct(string $name, array $handlers = [], array $processors = [], ?DateTimeZone $timezone = null) + public function __construct(string $name, array $handlers = [], array $processors = [], DateTimeZone|null $timezone = null) { $this->name = $name; $this->setHandlers($handlers); $this->processors = $processors; - $this->timezone = $timezone ?: new DateTimeZone(date_default_timezone_get() ?: 'UTC'); - - if (\PHP_VERSION_ID >= 80100) { - // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 - /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ - $fiberLogDepth = new \WeakMap(); - $this->fiberLogDepth = $fiberLogDepth; - } + $this->timezone = $timezone ?? new DateTimeZone(date_default_timezone_get()); } public function getName(): string @@ -236,7 +207,7 @@ class Logger implements LoggerInterface, ResettableInterface */ public function popHandler(): HandlerInterface { - if (!$this->handlers) { + if (0 === \count($this->handlers)) { throw new \LogicException('You tried to pop from an empty handler stack.'); } @@ -248,7 +219,7 @@ class Logger implements LoggerInterface, ResettableInterface * * If a map is passed, keys will be ignored. * - * @param HandlerInterface[] $handlers + * @param list $handlers */ public function setHandlers(array $handlers): self { @@ -261,7 +232,7 @@ class Logger implements LoggerInterface, ResettableInterface } /** - * @return HandlerInterface[] + * @return list */ public function getHandlers(): array { @@ -270,8 +241,10 @@ class Logger implements LoggerInterface, ResettableInterface /** * Adds a processor on to the stack. + * + * @phpstan-param ProcessorInterface|(callable(LogRecord): LogRecord) $callback */ - public function pushProcessor(callable $callback): self + public function pushProcessor(ProcessorInterface|callable $callback): self { array_unshift($this->processors, $callback); @@ -281,12 +254,12 @@ class Logger implements LoggerInterface, ResettableInterface /** * Removes the processor on top of the stack and returns it. * + * @phpstan-return ProcessorInterface|(callable(LogRecord): LogRecord) * @throws \LogicException If empty processor stack - * @return callable */ public function popProcessor(): callable { - if (!$this->processors) { + if (0 === \count($this->processors)) { throw new \LogicException('You tried to pop from an empty processor stack.'); } @@ -295,6 +268,7 @@ class Logger implements LoggerInterface, ResettableInterface /** * @return callable[] + * @phpstan-return array */ public function getProcessors(): array { @@ -335,58 +309,49 @@ class Logger implements LoggerInterface, ResettableInterface * @param DateTimeImmutable $datetime Optional log date to log into the past or future * @return bool Whether the record has been processed * - * @phpstan-param Level $level + * @phpstan-param value-of|Level $level */ - public function addRecord(int $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool + public function addRecord(int|Level $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool { - if (isset(self::RFC_5424_LEVELS[$level])) { + if (is_int($level) && isset(self::RFC_5424_LEVELS[$level])) { $level = self::RFC_5424_LEVELS[$level]; } if ($this->detectCycles) { - if (\PHP_VERSION_ID >= 80100 && $fiber = \Fiber::getCurrent()) { - $this->fiberLogDepth[$fiber] = $this->fiberLogDepth[$fiber] ?? 0; - $logDepth = ++$this->fiberLogDepth[$fiber]; - } else { - $logDepth = ++$this->logDepth; - } - } else { - $logDepth = 0; + $this->logDepth += 1; } - - if ($logDepth === 3) { + if ($this->logDepth === 3) { $this->warning('A possible infinite logging loop was detected and aborted. It appears some of your handler code is triggering logging, see the previous log record for a hint as to what may be the cause.'); return false; - } elseif ($logDepth >= 5) { // log depth 4 is let through, so we can log the warning above + } elseif ($this->logDepth >= 5) { // log depth 4 is let through so we can log the warning above return false; } try { - $record = null; + $recordInitialized = count($this->processors) === 0; + + $record = new LogRecord( + message: $message, + context: $context, + level: self::toMonologLevel($level), + channel: $this->name, + datetime: $datetime ?? new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), + extra: [], + ); + $handled = false; foreach ($this->handlers as $handler) { - if (null === $record) { - // skip creating the record as long as no handler is going to handle it - if (!$handler->isHandling(['level' => $level])) { + if (false === $recordInitialized) { + // skip initializing the record as long as no handler is going to handle it + if (!$handler->isHandling($record)) { continue; } - $levelName = static::getLevelName($level); - - $record = [ - 'message' => $message, - 'context' => $context, - 'level' => $level, - 'level_name' => $levelName, - 'channel' => $this->name, - 'datetime' => $datetime ?? new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), - 'extra' => [], - ]; - try { foreach ($this->processors as $processor) { $record = $processor($record); } + $recordInitialized = true; } catch (Throwable $e) { $this->handleException($e, $record); @@ -394,8 +359,9 @@ class Logger implements LoggerInterface, ResettableInterface } } - // once the record exists, send it to all handlers as long as the bubbling chain is not interrupted + // once the record is initialized, send it to all handlers as long as the bubbling chain is not interrupted try { + $handled = true; if (true === $handler->handle($record)) { break; } @@ -405,17 +371,13 @@ class Logger implements LoggerInterface, ResettableInterface return true; } } + + return $handled; } finally { if ($this->detectCycles) { - if (isset($fiber)) { - $this->fiberLogDepth[$fiber]--; - } else { - $this->logDepth--; - } + $this->logDepth--; } } - - return null !== $record; } /** @@ -461,77 +423,77 @@ class Logger implements LoggerInterface, ResettableInterface } /** - * Gets all supported logging levels. + * Gets the name of the logging level as a string. * - * @return array Assoc array with human-readable level names => level codes. - * @phpstan-return array - */ - public static function getLevels(): array - { - return array_flip(static::$levels); - } - - /** - * Gets the name of the logging level. + * This still returns a string instead of a Level for BC, but new code should not rely on this method. * * @throws \Psr\Log\InvalidArgumentException If level is not defined * - * @phpstan-param Level $level - * @phpstan-return LevelName + * @phpstan-param value-of|Level $level + * @phpstan-return value-of + * + * @deprecated Since 3.0, use {@see toMonologLevel} or {@see \Monolog\Level->getName()} instead */ - public static function getLevelName(int $level): string + public static function getLevelName(int|Level $level): string { - if (!isset(static::$levels[$level])) { - throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); - } - - return static::$levels[$level]; + return self::toMonologLevel($level)->getName(); } /** * Converts PSR-3 levels to Monolog ones if necessary * - * @param string|int $level Level number (monolog) or name (PSR-3) - * @throws \Psr\Log\InvalidArgumentException If level is not defined + * @param int|string|Level|LogLevel::* $level Level number (monolog) or name (PSR-3) + * @throws \Psr\Log\InvalidArgumentException If level is not defined * - * @phpstan-param Level|LevelName|LogLevel::* $level - * @phpstan-return Level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public static function toMonologLevel($level): int + public static function toMonologLevel(string|int|Level $level): Level { - if (is_string($level)) { - if (is_numeric($level)) { - /** @phpstan-ignore-next-line */ - return intval($level); + if ($level instanceof Level) { + return $level; + } + + if (\is_string($level)) { + if (\is_numeric($level)) { + $levelEnum = Level::tryFrom((int) $level); + if ($levelEnum === null) { + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', Level::NAMES + Level::VALUES)); + } + + return $levelEnum; } - // Contains chars of all log levels and avoids using strtoupper() which may have + // Contains first char of all log levels and avoids using strtoupper() which may have // strange results depending on locale (for example, "i" will become "İ" in Turkish locale) - $upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY'); - if (defined(__CLASS__.'::'.$upper)) { - return constant(__CLASS__ . '::' . $upper); + $upper = strtr(substr($level, 0, 1), 'dinweca', 'DINWECA') . strtolower(substr($level, 1)); + if (defined(Level::class.'::'.$upper)) { + return constant(Level::class . '::' . $upper); } - throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels)); + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', Level::NAMES + Level::VALUES)); } - if (!is_int($level)) { - throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels)); + $levelEnum = Level::tryFrom($level); + if ($levelEnum === null) { + throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', Level::NAMES + Level::VALUES)); } - return $level; + return $levelEnum; } /** * Checks whether the Logger has a handler that listens on the given level * - * @phpstan-param Level $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function isHandling(int $level): bool + public function isHandling(int|string|Level $level): bool { - $record = [ - 'level' => $level, - ]; + $record = new LogRecord( + datetime: new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), + channel: $this->name, + message: '', + level: self::toMonologLevel($level), + ); foreach ($this->handlers as $handler) { if ($handler->isHandling($record)) { @@ -545,16 +507,16 @@ class Logger implements LoggerInterface, ResettableInterface /** * Set a custom exception handler that will be called if adding a new record fails * - * The callable will receive an exception object and the record that failed to be logged + * The Closure will receive an exception object and the record that failed to be logged */ - public function setExceptionHandler(?callable $callback): self + public function setExceptionHandler(Closure|null $callback): self { $this->exceptionHandler = $callback; return $this; } - public function getExceptionHandler(): ?callable + public function getExceptionHandler(): Closure|null { return $this->exceptionHandler; } @@ -568,19 +530,21 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param Level|LogLevel::* $level */ - public function log($level, $message, array $context = []): void + public function log($level, string|\Stringable $message, array $context = []): void { - if (!is_int($level) && !is_string($level)) { - throw new \InvalidArgumentException('$level is expected to be a string or int'); - } + if (!$level instanceof Level) { + if (!is_string($level) && !is_int($level)) { + throw new \InvalidArgumentException('$level is expected to be a string, int or '.Level::class.' instance'); + } - if (isset(self::RFC_5424_LEVELS[$level])) { - $level = self::RFC_5424_LEVELS[$level]; - } + if (isset(self::RFC_5424_LEVELS[$level])) { + $level = self::RFC_5424_LEVELS[$level]; + } - $level = static::toMonologLevel($level); + $level = static::toMonologLevel($level); + } $this->addRecord($level, (string) $message, $context); } @@ -593,9 +557,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function debug($message, array $context = []): void + public function debug(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::DEBUG, (string) $message, $context); + $this->addRecord(Level::Debug, (string) $message, $context); } /** @@ -606,9 +570,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function info($message, array $context = []): void + public function info(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::INFO, (string) $message, $context); + $this->addRecord(Level::Info, (string) $message, $context); } /** @@ -619,9 +583,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function notice($message, array $context = []): void + public function notice(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::NOTICE, (string) $message, $context); + $this->addRecord(Level::Notice, (string) $message, $context); } /** @@ -632,9 +596,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function warning($message, array $context = []): void + public function warning(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::WARNING, (string) $message, $context); + $this->addRecord(Level::Warning, (string) $message, $context); } /** @@ -645,9 +609,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function error($message, array $context = []): void + public function error(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::ERROR, (string) $message, $context); + $this->addRecord(Level::Error, (string) $message, $context); } /** @@ -658,9 +622,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function critical($message, array $context = []): void + public function critical(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::CRITICAL, (string) $message, $context); + $this->addRecord(Level::Critical, (string) $message, $context); } /** @@ -671,9 +635,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function alert($message, array $context = []): void + public function alert(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::ALERT, (string) $message, $context); + $this->addRecord(Level::Alert, (string) $message, $context); } /** @@ -684,9 +648,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function emergency($message, array $context = []): void + public function emergency(string|\Stringable $message, array $context = []): void { - $this->addRecord(static::EMERGENCY, (string) $message, $context); + $this->addRecord(Level::Emergency, (string) $message, $context); } /** @@ -710,52 +674,13 @@ class Logger implements LoggerInterface, ResettableInterface /** * Delegates exception management to the custom exception handler, * or throws the exception if no custom handler is set. - * - * @param array $record - * @phpstan-param Record $record */ - protected function handleException(Throwable $e, array $record): void + protected function handleException(Throwable $e, LogRecord $record): void { - if (!$this->exceptionHandler) { + if (null === $this->exceptionHandler) { throw $e; } ($this->exceptionHandler)($e, $record); } - - /** - * @return array - */ - public function __serialize(): array - { - return [ - 'name' => $this->name, - 'handlers' => $this->handlers, - 'processors' => $this->processors, - 'microsecondTimestamps' => $this->microsecondTimestamps, - 'timezone' => $this->timezone, - 'exceptionHandler' => $this->exceptionHandler, - 'logDepth' => $this->logDepth, - 'detectCycles' => $this->detectCycles, - ]; - } - - /** - * @param array $data - */ - public function __unserialize(array $data): void - { - foreach (['name', 'handlers', 'processors', 'microsecondTimestamps', 'timezone', 'exceptionHandler', 'logDepth', 'detectCycles'] as $property) { - if (isset($data[$property])) { - $this->$property = $data[$property]; - } - } - - if (\PHP_VERSION_ID >= 80100) { - // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 - /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ - $fiberLogDepth = new \WeakMap(); - $this->fiberLogDepth = $fiberLogDepth; - } - } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php index 8166bdca..4cbd9c84 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php @@ -11,46 +11,44 @@ namespace Monolog\Processor; +use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Injects Git branch and Git commit SHA in all records * * @author Nick Otter * @author Jordi Boggiano - * - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class GitProcessor implements ProcessorInterface { - /** @var int */ - private $level; + private Level $level; /** @var array{branch: string, commit: string}|array|null */ private static $cache = null; /** - * @param string|int $level The minimum logging level at which this Processor will be triggered + * @param int|string|Level|LogLevel::* $level The minimum logging level at which this Processor will be triggered * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function __construct($level = Logger::DEBUG) + public function __construct(int|string|Level $level = Level::Debug) { $this->level = Logger::toMonologLevel($level); } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { // return if the level is not high enough - if ($record['level'] < $this->level) { + if ($record->level < $this->level) { return $record; } - $record['extra']['git'] = self::getGitInfo(); + $record->extra['git'] = self::getGitInfo(); return $record; } @@ -60,12 +58,12 @@ class GitProcessor implements ProcessorInterface */ private static function getGitInfo(): array { - if (self::$cache) { + if (self::$cache !== null) { return self::$cache; } - $branches = `git branch -v --no-abbrev`; - if ($branches && preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { + $branches = shell_exec('git branch -v --no-abbrev'); + if (is_string($branches) && 1 === preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { return self::$cache = [ 'branch' => $matches[1], 'commit' => $matches[2], diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php index 91fda7d6..cba6e096 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php @@ -11,13 +11,14 @@ namespace Monolog\Processor; +use Monolog\LogRecord; + /** * Injects value of gethostname in all records */ class HostnameProcessor implements ProcessorInterface { - /** @var string */ - private static $host; + private static string $host; public function __construct() { @@ -25,11 +26,11 @@ class HostnameProcessor implements ProcessorInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { - $record['extra']['hostname'] = self::$host; + $record->extra['hostname'] = self::$host; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php index a32e76b2..30e7dfed 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php @@ -11,8 +11,10 @@ namespace Monolog\Processor; +use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Injects line/file:class/function where the log message came from @@ -24,31 +26,28 @@ use Psr\Log\LogLevel; * triggered the FingersCrossedHandler. * * @author Jordi Boggiano - * - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class IntrospectionProcessor implements ProcessorInterface { - /** @var int */ - private $level; + private Level $level; + /** @var string[] */ - private $skipClassesPartials; - /** @var int */ - private $skipStackFramesCount; - /** @var string[] */ - private $skipFunctions = [ + private array $skipClassesPartials; + + private int $skipStackFramesCount; + + private const SKIP_FUNCTIONS = [ 'call_user_func', 'call_user_func_array', ]; /** - * @param string|int $level The minimum logging level at which this Processor will be triggered - * @param string[] $skipClassesPartials + * @param string|int|Level $level The minimum logging level at which this Processor will be triggered + * @param string[] $skipClassesPartials * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function __construct($level = Logger::DEBUG, array $skipClassesPartials = [], int $skipStackFramesCount = 0) + public function __construct(int|string|Level $level = Level::Debug, array $skipClassesPartials = [], int $skipStackFramesCount = 0) { $this->level = Logger::toMonologLevel($level); $this->skipClassesPartials = array_merge(['Monolog\\'], $skipClassesPartials); @@ -56,12 +55,12 @@ class IntrospectionProcessor implements ProcessorInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { // return if the level is not high enough - if ($record['level'] < $this->level) { + if ($record->level->isLowerThan($this->level)) { return $record; } @@ -83,7 +82,7 @@ class IntrospectionProcessor implements ProcessorInterface continue 2; } } - } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) { + } elseif (in_array($trace[$i]['function'], self::SKIP_FUNCTIONS, true)) { $i++; continue; @@ -95,8 +94,8 @@ class IntrospectionProcessor implements ProcessorInterface $i += $this->skipStackFramesCount; // we should have the call source now - $record['extra'] = array_merge( - $record['extra'], + $record->extra = array_merge( + $record->extra, [ 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null, 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null, @@ -110,7 +109,7 @@ class IntrospectionProcessor implements ProcessorInterface } /** - * @param array[] $trace + * @param array $trace */ private function isTraceClassOrSkippedFunction(array $trace, int $index): bool { @@ -118,6 +117,6 @@ class IntrospectionProcessor implements ProcessorInterface return false; } - return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions); + return isset($trace[$index]['class']) || in_array($trace[$index]['function'], self::SKIP_FUNCTIONS, true); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php index 37c756fc..adc32c65 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php @@ -11,6 +11,8 @@ namespace Monolog\Processor; +use Monolog\LogRecord; + /** * Injects memory_get_peak_usage in all records * @@ -20,9 +22,9 @@ namespace Monolog\Processor; class MemoryPeakUsageProcessor extends MemoryProcessor { /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { $usage = memory_get_peak_usage($this->realUsage); @@ -30,7 +32,7 @@ class MemoryPeakUsageProcessor extends MemoryProcessor $usage = $this->formatBytes($usage); } - $record['extra']['memory_peak_usage'] = $usage; + $record->extra['memory_peak_usage'] = $usage; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php index 227deb7c..f808e51b 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php @@ -21,12 +21,12 @@ abstract class MemoryProcessor implements ProcessorInterface /** * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. */ - protected $realUsage; + protected bool $realUsage; /** * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) */ - protected $useFormatting; + protected bool $useFormatting; /** * @param bool $realUsage Set this to true to get the real size of memory allocated from system. @@ -41,7 +41,6 @@ abstract class MemoryProcessor implements ProcessorInterface /** * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is * - * @param int $bytes * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as int */ protected function formatBytes(int $bytes) diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php index e141921e..a814b1df 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php @@ -11,6 +11,8 @@ namespace Monolog\Processor; +use Monolog\LogRecord; + /** * Injects memory_get_usage in all records * @@ -20,9 +22,9 @@ namespace Monolog\Processor; class MemoryUsageProcessor extends MemoryProcessor { /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { $usage = memory_get_usage($this->realUsage); @@ -30,7 +32,7 @@ class MemoryUsageProcessor extends MemoryProcessor $usage = $this->formatBytes($usage); } - $record['extra']['memory_usage'] = $usage; + $record->extra['memory_usage'] = $usage; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php index d4a628f5..47b1e64f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php @@ -11,45 +11,43 @@ namespace Monolog\Processor; +use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; +use Monolog\LogRecord; /** * Injects Hg branch and Hg revision number in all records * * @author Jonathan A. Schweder - * - * @phpstan-import-type LevelName from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger */ class MercurialProcessor implements ProcessorInterface { - /** @var Level */ - private $level; + private Level $level; /** @var array{branch: string, revision: string}|array|null */ private static $cache = null; /** - * @param int|string $level The minimum logging level at which this Processor will be triggered + * @param int|string|Level $level The minimum logging level at which this Processor will be triggered * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function __construct($level = Logger::DEBUG) + public function __construct(int|string|Level $level = Level::Debug) { $this->level = Logger::toMonologLevel($level); } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { // return if the level is not high enough - if ($record['level'] < $this->level) { + if ($record->level->isLowerThan($this->level)) { return $record; } - $record['extra']['hg'] = self::getMercurialInfo(); + $record->extra['hg'] = self::getMercurialInfo(); return $record; } @@ -59,11 +57,11 @@ class MercurialProcessor implements ProcessorInterface */ private static function getMercurialInfo(): array { - if (self::$cache) { + if (self::$cache !== null) { return self::$cache; } - $result = explode(' ', trim(`hg id -nb`)); + $result = explode(' ', trim((string) shell_exec('hg id -nb'))); if (count($result) >= 3) { return self::$cache = [ diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php index 3b939a95..bb9a5224 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php @@ -11,6 +11,8 @@ namespace Monolog\Processor; +use Monolog\LogRecord; + /** * Adds value of getmypid into records * @@ -19,11 +21,11 @@ namespace Monolog\Processor; class ProcessIdProcessor implements ProcessorInterface { /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { - $record['extra']['process_id'] = getmypid(); + $record->extra['process_id'] = getmypid(); return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php index 5defb7eb..ebe41fc2 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php @@ -11,20 +11,17 @@ namespace Monolog\Processor; +use Monolog\LogRecord; + /** * An optional interface to allow labelling Monolog processors. * * @author Nicolas Grekas - * - * @phpstan-import-type Record from \Monolog\Logger */ interface ProcessorInterface { /** - * @return array The processed record - * - * @phpstan-param Record $record - * @phpstan-return Record + * @return LogRecord The processed record */ - public function __invoke(array $record); + public function __invoke(LogRecord $record); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php index e7c12176..f2407d56 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php @@ -12,6 +12,7 @@ namespace Monolog\Processor; use Monolog\Utils; +use Monolog\LogRecord; /** * Processes a record's message according to PSR-3 rules @@ -24,11 +25,9 @@ class PsrLogMessageProcessor implements ProcessorInterface { public const SIMPLE_DATE = "Y-m-d\TH:i:s.uP"; - /** @var string|null */ - private $dateFormat; + private ?string $dateFormat; - /** @var bool */ - private $removeUsedContextFields; + private bool $removeUsedContextFields; /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format @@ -41,33 +40,33 @@ class PsrLogMessageProcessor implements ProcessorInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { - if (false === strpos($record['message'], '{')) { + if (false === strpos($record->message, '{')) { return $record; } $replacements = []; - foreach ($record['context'] as $key => $val) { + $context = $record->context; + + foreach ($context as $key => $val) { $placeholder = '{' . $key . '}'; - if (strpos($record['message'], $placeholder) === false) { + if (strpos($record->message, $placeholder) === false) { continue; } - if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { + if (null === $val || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { $replacements[$placeholder] = $val; } elseif ($val instanceof \DateTimeInterface) { - if (!$this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) { + if (null === $this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) { // handle monolog dates using __toString if no specific dateFormat was asked for // so that it follows the useMicroseconds flag $replacements[$placeholder] = (string) $val; } else { - $replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE); + $replacements[$placeholder] = $val->format($this->dateFormat ?? static::SIMPLE_DATE); } - } elseif ($val instanceof \UnitEnum) { - $replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name; } elseif (is_object($val)) { $replacements[$placeholder] = '[object '.Utils::getClass($val).']'; } elseif (is_array($val)) { @@ -77,12 +76,10 @@ class PsrLogMessageProcessor implements ProcessorInterface } if ($this->removeUsedContextFields) { - unset($record['context'][$key]); + unset($context[$key]); } } - $record['message'] = strtr($record['message'], $replacements); - - return $record; + return $record->with(message: strtr($record->message, $replacements), context: $context); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php index 80f18747..4543ccf6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php @@ -11,6 +11,8 @@ namespace Monolog\Processor; +use Monolog\LogRecord; + /** * Adds a tags array into record * @@ -19,7 +21,7 @@ namespace Monolog\Processor; class TagProcessor implements ProcessorInterface { /** @var string[] */ - private $tags; + private array $tags; /** * @param string[] $tags @@ -50,11 +52,11 @@ class TagProcessor implements ProcessorInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { - $record['extra']['tags'] = $this->tags; + $record->extra['tags'] = $this->tags; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php index a27b74db..3a0c128c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php @@ -12,6 +12,7 @@ namespace Monolog\Processor; use Monolog\ResettableInterface; +use Monolog\LogRecord; /** * Adds a unique identifier into records @@ -20,9 +21,12 @@ use Monolog\ResettableInterface; */ class UidProcessor implements ProcessorInterface, ResettableInterface { - /** @var string */ - private $uid; + /** @var non-empty-string */ + private string $uid; + /** + * @param int<1, 32> $length + */ public function __construct(int $length = 7) { if ($length > 32 || $length < 1) { @@ -33,11 +37,11 @@ class UidProcessor implements ProcessorInterface, ResettableInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { - $record['extra']['uid'] = $this->uid; + $record->extra['uid'] = $this->uid; return $record; } @@ -47,11 +51,15 @@ class UidProcessor implements ProcessorInterface, ResettableInterface return $this->uid; } - public function reset() + public function reset(): void { $this->uid = $this->generateUid(strlen($this->uid)); } + /** + * @param positive-int $length + * @return non-empty-string + */ private function generateUid(int $length): string { return substr(bin2hex(random_bytes((int) ceil($length / 2))), 0, $length); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php index 51850e17..2088b180 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php @@ -11,6 +11,9 @@ namespace Monolog\Processor; +use ArrayAccess; +use Monolog\LogRecord; + /** * Injects url/method and remote IP of the current web request in all records * @@ -19,9 +22,9 @@ namespace Monolog\Processor; class WebProcessor implements ProcessorInterface { /** - * @var array|\ArrayAccess + * @var array|ArrayAccess */ - protected $serverData; + protected array|ArrayAccess $serverData; /** * Default fields @@ -30,7 +33,7 @@ class WebProcessor implements ProcessorInterface * * @var array */ - protected $extraFields = [ + protected array $extraFields = [ 'url' => 'REQUEST_URI', 'ip' => 'REMOTE_ADDR', 'http_method' => 'REQUEST_METHOD', @@ -40,17 +43,15 @@ class WebProcessor implements ProcessorInterface ]; /** - * @param array|\ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data - * @param array|array|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data + * @param array|ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data + * @param array|array|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data */ - public function __construct($serverData = null, array $extraFields = null) + public function __construct(array|ArrayAccess|null $serverData = null, array|null $extraFields = null) { if (null === $serverData) { $this->serverData = &$_SERVER; - } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { - $this->serverData = $serverData; } else { - throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); + $this->serverData = $serverData; } $defaultEnabled = ['url', 'ip', 'http_method', 'server', 'referrer']; @@ -64,7 +65,7 @@ class WebProcessor implements ProcessorInterface } if (isset($extraFields[0])) { foreach (array_keys($this->extraFields) as $fieldName) { - if (!in_array($fieldName, $extraFields)) { + if (!in_array($fieldName, $extraFields, true)) { unset($this->extraFields[$fieldName]); } } @@ -74,9 +75,9 @@ class WebProcessor implements ProcessorInterface } /** - * {@inheritDoc} + * @inheritDoc */ - public function __invoke(array $record): array + public function __invoke(LogRecord $record): LogRecord { // skip processing if for some reason request data // is not present (CLI or wonky SAPIs) @@ -84,7 +85,7 @@ class WebProcessor implements ProcessorInterface return $record; } - $record['extra'] = $this->appendExtraFields($record['extra']); + $record->extra = $this->appendExtraFields($record->extra); return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Registry.php b/monolog/vendor/monolog/monolog/src/Monolog/Registry.php index ae94ae6c..2ef2edce 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Registry.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Registry.php @@ -42,7 +42,7 @@ class Registry * * @var Logger[] */ - private static $loggers = []; + private static array $loggers = []; /** * Adds new logging channel to the registry @@ -51,11 +51,10 @@ class Registry * @param string|null $name Name of the logging channel ($logger->getName() by default) * @param bool $overwrite Overwrite instance in the registry if the given name already exists? * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists - * @return void */ - public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false) + public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false): void { - $name = $name ?: $logger->getName(); + $name = $name ?? $logger->getName(); if (isset(self::$loggers[$name]) && !$overwrite) { throw new InvalidArgumentException('Logger with the given name already exists'); @@ -110,7 +109,7 @@ class Registry * @param string $name Name of the requested Logger instance * @throws \InvalidArgumentException If named Logger instance is not in the registry */ - public static function getInstance($name): Logger + public static function getInstance(string $name): Logger { if (!isset(self::$loggers[$name])) { throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name)); @@ -127,7 +126,7 @@ class Registry * @throws \InvalidArgumentException If named Logger instance is not in the registry * @return Logger Requested instance of Logger */ - public static function __callStatic($name, $arguments) + public static function __callStatic(string $name, array $arguments): Logger { return self::getInstance($name); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php index 2c5fd785..4983a6b3 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php @@ -27,8 +27,5 @@ namespace Monolog; */ interface ResettableInterface { - /** - * @return void - */ - public function reset(); + public function reset(): void; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php index d730eea3..e6b02b08 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php @@ -19,21 +19,17 @@ use ReflectionExtension; * Monolog POSIX signal handler * * @author Robert Gust-Bardon - * - * @phpstan-import-type Level from \Monolog\Logger - * @phpstan-import-type LevelName from \Monolog\Logger */ class SignalHandler { - /** @var LoggerInterface */ - private $logger; + private LoggerInterface $logger; /** @var array SIG_DFL, SIG_IGN or previous callable */ - private $previousSignalHandler = []; - /** @var array */ - private $signalLevelMap = []; + private array $previousSignalHandler = []; + /** @var array */ + private array $signalLevelMap = []; /** @var array */ - private $signalRestartSyscalls = []; + private array $signalRestartSyscalls = []; public function __construct(LoggerInterface $logger) { @@ -41,21 +37,18 @@ class SignalHandler } /** - * @param int|string $level Level or level name - * @param bool $callPrevious - * @param bool $restartSyscalls - * @param bool|null $async + * @param int|string|Level $level Level or level name * @return $this * - * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - public function registerSignalHandler(int $signo, $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self + public function registerSignalHandler(int $signo, int|string|Level $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self { if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { return $this; } - $level = Logger::toMonologLevel($level); + $level = Logger::toMonologLevel($level)->toPsrLogLevel(); if ($callPrevious) { $handler = pcntl_signal_get_handler($signo); @@ -84,8 +77,7 @@ class SignalHandler if (!$signals && extension_loaded('pcntl')) { $pcntl = new ReflectionExtension('pcntl'); - // HHVM 3.24.2 returns an empty array. - foreach ($pcntl->getConstants() ?: get_defined_constants(true)['Core'] as $name => $value) { + foreach ($pcntl->getConstants() as $name => $value) { if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) { $signals[$value] = $name; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php b/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php index bc0b425e..98204a95 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php @@ -11,18 +11,18 @@ namespace Monolog\Test; +use Monolog\Level; use Monolog\Logger; +use Monolog\LogRecord; use Monolog\DateTimeImmutable; use Monolog\Formatter\FormatterInterface; +use Psr\Log\LogLevel; /** * Lets you easily generate log records and a dummy formatter for testing purposes * * @author Jordi Boggiano * - * @phpstan-import-type Record from \Monolog\Logger - * @phpstan-import-type Level from \Monolog\Logger - * * @internal feel free to reuse this to test your own handlers, this is marked internal to avoid issues with PHPStorm https://github.com/Seldaek/monolog/issues/1677 */ class TestCase extends \PHPUnit\Framework\TestCase @@ -37,47 +37,44 @@ class TestCase extends \PHPUnit\Framework\TestCase } /** - * @param mixed[] $context + * @param array $context + * @param array $extra * - * @return array Record - * - * @phpstan-param Level $level - * @phpstan-return Record + * @phpstan-param value-of|value-of|Level|LogLevel::* $level */ - protected function getRecord(int $level = Logger::WARNING, string $message = 'test', array $context = []): array + protected function getRecord(int|string|Level $level = Level::Warning, string|\Stringable $message = 'test', array $context = [], string $channel = 'test', \DateTimeImmutable $datetime = new DateTimeImmutable(true), array $extra = []): LogRecord { - return [ - 'message' => (string) $message, - 'context' => $context, - 'level' => $level, - 'level_name' => Logger::getLevelName($level), - 'channel' => 'test', - 'datetime' => new DateTimeImmutable(true), - 'extra' => [], - ]; + return new LogRecord( + message: (string) $message, + context: $context, + level: Logger::toMonologLevel($level), + channel: $channel, + datetime: $datetime, + extra: $extra, + ); } /** - * @phpstan-return Record[] + * @phpstan-return list */ protected function getMultipleRecords(): array { return [ - $this->getRecord(Logger::DEBUG, 'debug message 1'), - $this->getRecord(Logger::DEBUG, 'debug message 2'), - $this->getRecord(Logger::INFO, 'information'), - $this->getRecord(Logger::WARNING, 'warning'), - $this->getRecord(Logger::ERROR, 'error'), + $this->getRecord(Level::Debug, 'debug message 1'), + $this->getRecord(Level::Debug, 'debug message 2'), + $this->getRecord(Level::Info, 'information'), + $this->getRecord(Level::Warning, 'warning'), + $this->getRecord(Level::Error, 'error'), ]; } protected function getIdentityFormatter(): FormatterInterface { $formatter = $this->createMock(FormatterInterface::class); - $formatter->expects($this->any()) + $formatter->expects(self::any()) ->method('format') - ->will($this->returnCallback(function ($record) { - return $record['message']; + ->will(self::returnCallback(function ($record) { + return $record->message; })); return $formatter; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Utils.php b/monolog/vendor/monolog/monolog/src/Monolog/Utils.php index 360c4219..9dae2535 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Utils.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Utils.php @@ -122,7 +122,7 @@ final class Utils if (is_string($data)) { self::detectAndCleanUtf8($data); } elseif (is_array($data)) { - array_walk_recursive($data, array('Monolog\Utils', 'detectAndCleanUtf8')); + array_walk_recursive($data, ['Monolog\Utils', 'detectAndCleanUtf8']); } else { self::throwEncodeError($code, $data); } @@ -165,27 +165,16 @@ final class Utils * @param int $code return code of json_last_error function * @param mixed $data data that was meant to be encoded * @throws \RuntimeException - * - * @return never */ - private static function throwEncodeError(int $code, $data): void + private static function throwEncodeError(int $code, $data): never { - switch ($code) { - case JSON_ERROR_DEPTH: - $msg = 'Maximum stack depth exceeded'; - break; - case JSON_ERROR_STATE_MISMATCH: - $msg = 'Underflow or the modes mismatch'; - break; - case JSON_ERROR_CTRL_CHAR: - $msg = 'Unexpected control character found'; - break; - case JSON_ERROR_UTF8: - $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; - break; - default: - $msg = 'Unknown error'; - } + $msg = match ($code) { + JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', + JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', + JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', + JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', + default => 'Unknown error', + }; throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); } @@ -207,7 +196,7 @@ final class Utils */ private static function detectAndCleanUtf8(&$data): void { - if (is_string($data) && !preg_match('//u', $data)) { + if (is_string($data) && preg_match('//u', $data) !== 1) { $data = preg_replace_callback( '/[\x80-\xFF]+/', function ($m) { @@ -217,6 +206,7 @@ final class Utils ); if (!is_string($data)) { $pcreErrorCode = preg_last_error(); + throw new \RuntimeException('Failed to preg_replace_callback: ' . $pcreErrorCode . ' / ' . self::pcreLastErrorMessage($pcreErrorCode)); } $data = str_replace( @@ -230,8 +220,8 @@ final class Utils /** * Converts a string with a valid 'memory_limit' format, to bytes. * - * @param string|false $val - * @return int|false Returns an integer representing bytes. Returns FALSE in case of error. + * @param string|false $val + * @return int|false Returns an integer representing bytes. Returns FALSE in case of error. */ public static function expandIniShorthandBytes($val) { @@ -244,7 +234,7 @@ final class Utils return (int) $val; } - if (!preg_match('/^\s*(?\d+)(?:\.\d+)?\s*(?[gmk]?)\s*$/i', $val, $match)) { + if (preg_match('/^\s*(?\d+)(?:\.\d+)?\s*(?[gmk]?)\s*$/i', $val, $match) !== 1) { return false; } @@ -252,8 +242,10 @@ final class Utils switch (strtolower($match['unit'] ?? '')) { case 'g': $val *= 1024; + // no break case 'm': $val *= 1024; + // no break case 'k': $val *= 1024; } @@ -261,24 +253,22 @@ final class Utils return $val; } - /** - * @param array $record - */ - public static function getRecordMessageForException(array $record): string + public static function getRecordMessageForException(LogRecord $record): string { $context = ''; $extra = ''; + try { - if ($record['context']) { - $context = "\nContext: " . json_encode($record['context']); + if (\count($record->context) > 0) { + $context = "\nContext: " . json_encode($record->context, JSON_THROW_ON_ERROR); } - if ($record['extra']) { - $extra = "\nExtra: " . json_encode($record['extra']); + if (\count($record->extra) > 0) { + $extra = "\nExtra: " . json_encode($record->extra, JSON_THROW_ON_ERROR); } } catch (\Throwable $e) { // noop } - return "\nThe exception occurred while attempting to log: " . $record['message'] . $context . $extra; + return "\nThe exception occurred while attempting to log: " . $record->message . $context . $extra; } } diff --git a/monolog/vendor/psr/log/composer.json b/monolog/vendor/psr/log/composer.json index ca056953..879fc6f5 100644 --- a/monolog/vendor/psr/log/composer.json +++ b/monolog/vendor/psr/log/composer.json @@ -11,16 +11,16 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } } } diff --git a/monolog/vendor/psr/log/src/AbstractLogger.php b/monolog/vendor/psr/log/src/AbstractLogger.php new file mode 100644 index 00000000..d60a091a --- /dev/null +++ b/monolog/vendor/psr/log/src/AbstractLogger.php @@ -0,0 +1,15 @@ +logger = $logger; + } +} diff --git a/monolog/vendor/psr/log/src/LoggerInterface.php b/monolog/vendor/psr/log/src/LoggerInterface.php new file mode 100644 index 00000000..b3a24b5f --- /dev/null +++ b/monolog/vendor/psr/log/src/LoggerInterface.php @@ -0,0 +1,125 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function alert(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function critical(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function error(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function warning(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function notice(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function info(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function debug(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::DEBUG, $message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string|\Stringable $message + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException + */ + abstract public function log($level, string|\Stringable $message, array $context = []): void; +} diff --git a/monolog/vendor/psr/log/src/NullLogger.php b/monolog/vendor/psr/log/src/NullLogger.php new file mode 100644 index 00000000..c1cc3c06 --- /dev/null +++ b/monolog/vendor/psr/log/src/NullLogger.php @@ -0,0 +1,30 @@ +logger) { }` + * blocks. + */ +class NullLogger extends AbstractLogger +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string|\Stringable $message + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException + */ + public function log($level, string|\Stringable $message, array $context = []): void + { + // noop + } +} diff --git a/morechoice/morechoice.php b/morechoice/morechoice.php index fbb88ce1..fe726d27 100644 --- a/morechoice/morechoice.php +++ b/morechoice/morechoice.php @@ -8,6 +8,7 @@ * Status: Deprecated */ +use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php index 2ac09a73..abe59a6e 100644 --- a/morepokes/morepokes.php +++ b/morepokes/morepokes.php @@ -7,6 +7,7 @@ * */ +use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; diff --git a/newmemberwidget/lang/cs/messages.po b/newmemberwidget/lang/cs/messages.po index 387144ab..60473473 100644 --- a/newmemberwidget/lang/cs/messages.po +++ b/newmemberwidget/lang/cs/messages.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" "Last-Translator: Aditoo, 2018\n" "Language-Team: Czech (http://app.transifex.com/Friendica/friendica/language/cs/)\n" @@ -29,48 +29,48 @@ msgid "Tips for New Members" msgstr "Tipy pro nové členy" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "" +msgid "Global Support Forum" +msgstr "Globální fórum podpory" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +msgid "Local Support Forum" +msgstr "Místní fórum podpory" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Uložit nastavení" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Zpráva" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Vaše zpráva pro nové členy. Zde můžete použít BBCode." -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "Přidejte odkaz na globální fórum podpory" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "Má být zobrazen odkaz na globální fórum podpory?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "Přidejte odkaz na místní fórum podpory" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "Název místního fóra podpory" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/cs/strings.php b/newmemberwidget/lang/cs/strings.php index 2f150466..3b6dc272 100644 --- a/newmemberwidget/lang/cs/strings.php +++ b/newmemberwidget/lang/cs/strings.php @@ -7,8 +7,13 @@ function string_plural_select_cs($n){ }} $a->strings['New Member'] = 'Nový člen'; $a->strings['Tips for New Members'] = 'Tipy pro nové členy'; +$a->strings['Global Support Forum'] = 'Globální fórum podpory'; +$a->strings['Local Support Forum'] = 'Místní fórum podpory'; $a->strings['Save Settings'] = 'Uložit nastavení'; $a->strings['Message'] = 'Zpráva'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Vaše zpráva pro nové členy. Zde můžete použít BBCode.'; +$a->strings['Add a link to global support forum'] = 'Přidejte odkaz na globální fórum podpory'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Má být zobrazen odkaz na globální fórum podpory?'; +$a->strings['Add a link to the local support forum'] = 'Přidejte odkaz na místní fórum podpory'; $a->strings['Name of the local support group'] = 'Název místního fóra podpory'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Pokud jste zaškrtl/a výše uvedenou možnost, specifikujte zde přezdívku místní skupiny podpory (např. pomocnici)'; diff --git a/newmemberwidget/lang/de/messages.po b/newmemberwidget/lang/de/messages.po index 87289e3e..851dfdce 100644 --- a/newmemberwidget/lang/de/messages.po +++ b/newmemberwidget/lang/de/messages.po @@ -4,16 +4,15 @@ # # # Translators: -# Raroun, 2023 # Tobias Diekershoff , 2021 # Ulf Rompe , 2019 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Raroun, 2023\n" +"Last-Translator: Tobias Diekershoff , 2021\n" "Language-Team: German (http://app.transifex.com/Friendica/friendica/language/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -30,48 +29,48 @@ msgid "Tips for New Members" msgstr "Tipps für neue Nutzer" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "Globale Support-Gruppe" +msgid "Global Support Forum" +msgstr "Globales Forum für Hilfsanfragen" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "Lokale Support-Gruppe" +msgid "Local Support Forum" +msgstr "Lokales Forum für Hilfsanfragen" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Einstellungen speichern" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Nachricht" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Deine Nachricht für neue Nutzer. BBCode kann verwendet werden." -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "Fügen Sie einen Link der globalen Support-Gruppe hinzu" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "Link zum globalen Support-Forum anzeigen" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "Soll ein Link zur globalen Support-Gruppe angezeigt werden?" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "Soll ein Link zum globalen Support-Forum angezeigt werden?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "Fügen Sie einen Link der lokalen Support-Gruppe hinzu" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "Link zum lokalen Support-Forum anzeigen" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." -msgstr "Wenn Sie eine lokale Support-Gruppe haben und einen Link im Widget anzeigen lassen möchten, markieren Sie dieses Feld." +msgstr "Wenn du ein lokales Support-Forum eingerichtet hast und ein Link darauf angezeigt werden soll, schalte dies ein." -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "Name des lokalen Support-Forums" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/de/strings.php b/newmemberwidget/lang/de/strings.php index aa3e0f88..c7dc503c 100644 --- a/newmemberwidget/lang/de/strings.php +++ b/newmemberwidget/lang/de/strings.php @@ -7,14 +7,14 @@ function string_plural_select_de($n){ }} $a->strings['New Member'] = 'Neue Nutzer'; $a->strings['Tips for New Members'] = 'Tipps für neue Nutzer'; -$a->strings['Global Support Group'] = 'Globale Support-Gruppe'; -$a->strings['Local Support Group'] = 'Lokale Support-Gruppe'; +$a->strings['Global Support Forum'] = 'Globales Forum für Hilfsanfragen'; +$a->strings['Local Support Forum'] = 'Lokales Forum für Hilfsanfragen'; $a->strings['Save Settings'] = 'Einstellungen speichern'; $a->strings['Message'] = 'Nachricht'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Deine Nachricht für neue Nutzer. BBCode kann verwendet werden.'; -$a->strings['Add a link to global support group'] = 'Fügen Sie einen Link der globalen Support-Gruppe hinzu'; -$a->strings['Should a link to the global support group be displayed?'] = 'Soll ein Link zur globalen Support-Gruppe angezeigt werden?'; -$a->strings['Add a link to the local support group'] = 'Fügen Sie einen Link der lokalen Support-Gruppe hinzu'; -$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Wenn Sie eine lokale Support-Gruppe haben und einen Link im Widget anzeigen lassen möchten, markieren Sie dieses Feld.'; +$a->strings['Add a link to global support forum'] = 'Link zum globalen Support-Forum anzeigen'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Soll ein Link zum globalen Support-Forum angezeigt werden?'; +$a->strings['Add a link to the local support forum'] = 'Link zum lokalen Support-Forum anzeigen'; +$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Wenn du ein lokales Support-Forum eingerichtet hast und ein Link darauf angezeigt werden soll, schalte dies ein.'; $a->strings['Name of the local support group'] = 'Name des lokalen Support-Forums'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Wenn der Link angezeigt werden soll, dann trage hier den Spitznamen des Forums ein (z.B. helpers)'; diff --git a/newmemberwidget/lang/es/messages.po b/newmemberwidget/lang/es/messages.po index b731a041..fb31e143 100644 --- a/newmemberwidget/lang/es/messages.po +++ b/newmemberwidget/lang/es/messages.po @@ -10,15 +10,15 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" -"PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Senex Petrovic , 2021\n" -"Language-Team: Spanish (http://app.transifex.com/Friendica/friendica/language/es/)\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2021-04-06 01:46+0000\n" +"Last-Translator: Senex Petrovic \n" +"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es\n" -"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: newmemberwidget.php:29 msgid "New Member" @@ -29,48 +29,48 @@ msgid "Tips for New Members" msgstr "Consejos para Nuevos Miembros" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "" +msgid "Global Support Forum" +msgstr "Foro de Soporte Global" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +msgid "Local Support Forum" +msgstr "Foro de Soporte Local" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Guardar Ajustes" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Mensaje" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Su mensaje para los nuevos miembros. Puede usar bbcode aquí" -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "Añadir un enlace al foro de soporte global" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "¿Debería mostrarse un enlace al foro de soporte global?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "Añadir un enlace al foro de soporte local" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." -msgstr "" +msgstr "Si tiene foro de soporte local y desea que se muestre un enlace en el widget, marque esta casilla." -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "Nombre del grupo de soporte local" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/es/strings.php b/newmemberwidget/lang/es/strings.php index 8798813a..28253b73 100644 --- a/newmemberwidget/lang/es/strings.php +++ b/newmemberwidget/lang/es/strings.php @@ -3,12 +3,18 @@ if(! function_exists("string_plural_select_es")) { function string_plural_select_es($n){ $n = intval($n); - if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } + return intval($n != 1); }} $a->strings['New Member'] = 'Nuevo Miembro'; $a->strings['Tips for New Members'] = 'Consejos para Nuevos Miembros'; +$a->strings['Global Support Forum'] = 'Foro de Soporte Global'; +$a->strings['Local Support Forum'] = 'Foro de Soporte Local'; $a->strings['Save Settings'] = 'Guardar Ajustes'; $a->strings['Message'] = 'Mensaje'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Su mensaje para los nuevos miembros. Puede usar bbcode aquí'; +$a->strings['Add a link to global support forum'] = 'Añadir un enlace al foro de soporte global'; +$a->strings['Should a link to the global support forum be displayed?'] = '¿Debería mostrarse un enlace al foro de soporte global?'; +$a->strings['Add a link to the local support forum'] = 'Añadir un enlace al foro de soporte local'; +$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Si tiene foro de soporte local y desea que se muestre un enlace en el widget, marque esta casilla.'; $a->strings['Name of the local support group'] = 'Nombre del grupo de soporte local'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Si chequeó arriba, especifique el apodo del grupo de soporte local aquí (asistentes)'; diff --git a/newmemberwidget/lang/et/messages.po b/newmemberwidget/lang/et/messages.po index 6f52dff8..969efad9 100644 --- a/newmemberwidget/lang/et/messages.po +++ b/newmemberwidget/lang/et/messages.po @@ -9,67 +9,67 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" -"PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Rain Hawk, 2019\n" -"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"POT-Creation-Date: 2014-06-01 14:12+0200\n" +"PO-Revision-Date: 2019-04-16 05:07+0000\n" +"Last-Translator: Rain Hawk\n" +"Language-Team: Estonian (http://www.transifex.com/Friendica/friendica/language/et/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: et\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: newmemberwidget.php:29 +#: newmemberwidget.php:21 msgid "New Member" msgstr "Uus liige" -#: newmemberwidget.php:30 +#: newmemberwidget.php:22 msgid "Tips for New Members" msgstr "Nippe uutele liikmetele" -#: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "" +#: newmemberwidget.php:24 +msgid "Global Support Forum" +msgstr "Globaalne tugifoorum" -#: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +#: newmemberwidget.php:26 +msgid "Local Support Forum" +msgstr "Lokaalne tugifoorum" -#: newmemberwidget.php:62 +#: newmemberwidget.php:49 msgid "Save Settings" msgstr "Salvesta sätted" -#: newmemberwidget.php:63 +#: newmemberwidget.php:50 msgid "Message" msgstr "Sõnum" -#: newmemberwidget.php:63 +#: newmemberwidget.php:50 msgid "Your message for new members. You can use bbcode here." msgstr "" -#: newmemberwidget.php:64 -msgid "Add a link to global support group" +#: newmemberwidget.php:51 +msgid "Add a link to global support forum" msgstr "" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" +#: newmemberwidget.php:51 +msgid "Should a link to the global support forum be displayed?" msgstr "" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" +#: newmemberwidget.php:52 +msgid "Add a link to the local support forum" msgstr "" -#: newmemberwidget.php:65 +#: newmemberwidget.php:52 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and wand to have a link displayed in the " "widget, check this box." msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:53 msgid "Name of the local support group" msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:53 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/et/strings.php b/newmemberwidget/lang/et/strings.php index e4465d99..3d4f8167 100644 --- a/newmemberwidget/lang/et/strings.php +++ b/newmemberwidget/lang/et/strings.php @@ -7,5 +7,7 @@ function string_plural_select_et($n){ }} $a->strings['New Member'] = 'Uus liige'; $a->strings['Tips for New Members'] = 'Nippe uutele liikmetele'; +$a->strings['Global Support Forum'] = 'Globaalne tugifoorum'; +$a->strings['Local Support Forum'] = 'Lokaalne tugifoorum'; $a->strings['Save Settings'] = 'Salvesta sätted'; $a->strings['Message'] = 'Sõnum'; diff --git a/newmemberwidget/lang/fr/messages.po b/newmemberwidget/lang/fr/messages.po index 3e1f2505..296c2755 100644 --- a/newmemberwidget/lang/fr/messages.po +++ b/newmemberwidget/lang/fr/messages.po @@ -4,7 +4,6 @@ # # # Translators: -# Florent C., 2023 # Hypolite Petovan , 2022 # Nicolas Derive, 2022 # StefOfficiel , 2015 @@ -12,10 +11,10 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Florent C., 2023\n" -"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: Nicolas Derive, 2022\n" +"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,48 +30,48 @@ msgid "Tips for New Members" msgstr "Conseils aux nouveaux venus" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "Groupe de support global" +msgid "Global Support Forum" +msgstr "Forum de support global" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "Groupe de support local" +msgid "Local Support Forum" +msgstr "Forum de support local" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Enregistrer les paramètres" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Message" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Votre messages aux nouveaux venus. Vous pouvez utiliser des BBCodes." -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "Ajouter un lien vers le groupe de support global" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "Ajouter un lien vers le forum de support global" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "Montrer un lien vers le groupe de support global ?" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "Montrer un lien vers le forum de support global?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "Ajouter un lien vers le groupe de support local" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "Ajouter un lien vers le forum de support local" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." -msgstr "Si vous avez un groupe de support local et désirez avoir un lien affiché dans l'appliquette/widget, cochez cette case." +msgstr "Si vous avez un forum d'assistance local et désirez avoir un lien affiché dans l'appliquette/widget, cochez cette case." -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "Nom du groupe de support local" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/fr/strings.php b/newmemberwidget/lang/fr/strings.php index cc437f89..8de178f2 100644 --- a/newmemberwidget/lang/fr/strings.php +++ b/newmemberwidget/lang/fr/strings.php @@ -7,14 +7,14 @@ function string_plural_select_fr($n){ }} $a->strings['New Member'] = 'Nouveau Membre'; $a->strings['Tips for New Members'] = 'Conseils aux nouveaux venus'; -$a->strings['Global Support Group'] = 'Groupe de support global'; -$a->strings['Local Support Group'] = 'Groupe de support local'; +$a->strings['Global Support Forum'] = 'Forum de support global'; +$a->strings['Local Support Forum'] = 'Forum de support local'; $a->strings['Save Settings'] = 'Enregistrer les paramètres'; $a->strings['Message'] = 'Message'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Votre messages aux nouveaux venus. Vous pouvez utiliser des BBCodes.'; -$a->strings['Add a link to global support group'] = 'Ajouter un lien vers le groupe de support global'; -$a->strings['Should a link to the global support group be displayed?'] = 'Montrer un lien vers le groupe de support global ?'; -$a->strings['Add a link to the local support group'] = 'Ajouter un lien vers le groupe de support local'; -$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Si vous avez un groupe de support local et désirez avoir un lien affiché dans l\'appliquette/widget, cochez cette case.'; +$a->strings['Add a link to global support forum'] = 'Ajouter un lien vers le forum de support global'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Montrer un lien vers le forum de support global?'; +$a->strings['Add a link to the local support forum'] = 'Ajouter un lien vers le forum de support local'; +$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Si vous avez un forum d\'assistance local et désirez avoir un lien affiché dans l\'appliquette/widget, cochez cette case.'; $a->strings['Name of the local support group'] = 'Nom du groupe de support local'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Si vous avez coché la case ci-dessus, spécifiez le nom d\'utilisateur du groupe de support local (par ex. "helpers")'; diff --git a/newmemberwidget/lang/hu/messages.po b/newmemberwidget/lang/hu/messages.po index f3babd21..41453463 100644 --- a/newmemberwidget/lang/hu/messages.po +++ b/newmemberwidget/lang/hu/messages.po @@ -4,15 +4,15 @@ # # # Translators: -# Balázs Úr, 2020-2021,2023 +# Balázs Úr, 2020-2021 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Balázs Úr, 2020-2021,2023\n" -"Language-Team: Hungarian (http://app.transifex.com/Friendica/friendica/language/hu/)\n" +"Last-Translator: Balázs Úr, 2020-2021\n" +"Language-Team: Hungarian (http://www.transifex.com/Friendica/friendica/language/hu/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -28,48 +28,48 @@ msgid "Tips for New Members" msgstr "Tippek új tagoknak" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "Globális támogatási csoport" +msgid "Global Support Forum" +msgstr "Globális támogató fórum" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "Helyi támogatási csoport" +msgid "Local Support Forum" +msgstr "Helyi támogató fórum" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Beállítások mentése" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Üzenet" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Az Ön üzenete az új tagoknak. Itt használhat BBCode-ot." -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "A globális támogatási csoportra mutató hivatkozás hozzáadása" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "A globális támogató fórumra mutató hivatkozás hozzáadása" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "Meg kell jeleníteni a globális támogatási csoportra mutató hivatkozást?" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "Meg kell jeleníteni a globális támogató fórumra mutató hivatkozást?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "A helyi támogatási csoportra mutató hivatkozás hozzáadása" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "A helyi támogató fórumra mutató hivatkozás hozzáadása" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." -msgstr "Ha van helyi támogatási csoportja és meg szeretne jeleníteni egy hivatkozást a felületi elemben, akkor jelölje be ezt a négyzetet." +msgstr "Ha van helyi támogató fóruma és szeretne egy hivatkozást megjeleníteni a felületi elemben, akkor jelölje be azt a négyzetet." -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "A helyi támogató csoport neve" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/hu/strings.php b/newmemberwidget/lang/hu/strings.php index 2f0066cd..edf2a003 100644 --- a/newmemberwidget/lang/hu/strings.php +++ b/newmemberwidget/lang/hu/strings.php @@ -7,14 +7,14 @@ function string_plural_select_hu($n){ }} $a->strings['New Member'] = 'Új tag'; $a->strings['Tips for New Members'] = 'Tippek új tagoknak'; -$a->strings['Global Support Group'] = 'Globális támogatási csoport'; -$a->strings['Local Support Group'] = 'Helyi támogatási csoport'; +$a->strings['Global Support Forum'] = 'Globális támogató fórum'; +$a->strings['Local Support Forum'] = 'Helyi támogató fórum'; $a->strings['Save Settings'] = 'Beállítások mentése'; $a->strings['Message'] = 'Üzenet'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Az Ön üzenete az új tagoknak. Itt használhat BBCode-ot.'; -$a->strings['Add a link to global support group'] = 'A globális támogatási csoportra mutató hivatkozás hozzáadása'; -$a->strings['Should a link to the global support group be displayed?'] = 'Meg kell jeleníteni a globális támogatási csoportra mutató hivatkozást?'; -$a->strings['Add a link to the local support group'] = 'A helyi támogatási csoportra mutató hivatkozás hozzáadása'; -$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Ha van helyi támogatási csoportja és meg szeretne jeleníteni egy hivatkozást a felületi elemben, akkor jelölje be ezt a négyzetet.'; +$a->strings['Add a link to global support forum'] = 'A globális támogató fórumra mutató hivatkozás hozzáadása'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Meg kell jeleníteni a globális támogató fórumra mutató hivatkozást?'; +$a->strings['Add a link to the local support forum'] = 'A helyi támogató fórumra mutató hivatkozás hozzáadása'; +$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Ha van helyi támogató fóruma és szeretne egy hivatkozást megjeleníteni a felületi elemben, akkor jelölje be azt a négyzetet.'; $a->strings['Name of the local support group'] = 'A helyi támogató csoport neve'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Ha bejelölte a fentit, akkor itt adja meg a helyi támogató csoport becenevét (például segítők)'; diff --git a/newmemberwidget/lang/it/messages.po b/newmemberwidget/lang/it/messages.po index 91d5c03e..389d7337 100644 --- a/newmemberwidget/lang/it/messages.po +++ b/newmemberwidget/lang/it/messages.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" "Last-Translator: Sylke Vicious , 2020-2021\n" "Language-Team: Italian (http://app.transifex.com/Friendica/friendica/language/it/)\n" @@ -29,48 +29,48 @@ msgid "Tips for New Members" msgstr "Consigli per i Nuovi Utenti" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "" +msgid "Global Support Forum" +msgstr "Forum Globale di Supporto" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +msgid "Local Support Forum" +msgstr "Forum Locale di Supporto" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Salva Impostazioni" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Messaggio" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Il tuo messaggio per i nuovi utenti. Puoi usare BBCode" -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "Aggiunge un collegamento al forum di supporto globale" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "Mostrare il collegamento al forum di supporto globale?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "Aggiunge un collegamento al forum di supporto locale" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." -msgstr "" +msgstr "Se hai un forum di supporto locale e vuoi che sia mostrato il collegamento nel widget, seleziona questo box." -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "Nome del gruppo locale di supporto" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/it/strings.php b/newmemberwidget/lang/it/strings.php index 56798c2a..f459f79e 100644 --- a/newmemberwidget/lang/it/strings.php +++ b/newmemberwidget/lang/it/strings.php @@ -7,8 +7,14 @@ function string_plural_select_it($n){ }} $a->strings['New Member'] = 'Nuovi Utenti'; $a->strings['Tips for New Members'] = 'Consigli per i Nuovi Utenti'; +$a->strings['Global Support Forum'] = 'Forum Globale di Supporto'; +$a->strings['Local Support Forum'] = 'Forum Locale di Supporto'; $a->strings['Save Settings'] = 'Salva Impostazioni'; $a->strings['Message'] = 'Messaggio'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Il tuo messaggio per i nuovi utenti. Puoi usare BBCode'; +$a->strings['Add a link to global support forum'] = 'Aggiunge un collegamento al forum di supporto globale'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Mostrare il collegamento al forum di supporto globale?'; +$a->strings['Add a link to the local support forum'] = 'Aggiunge un collegamento al forum di supporto locale'; +$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Se hai un forum di supporto locale e vuoi che sia mostrato il collegamento nel widget, seleziona questo box.'; $a->strings['Name of the local support group'] = 'Nome del gruppo locale di supporto'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Se hai selezionato il box sopra, specifica qui il nome utente del gruppo locale di supporto (e.s. \'supporto\')'; diff --git a/newmemberwidget/lang/pl/messages.po b/newmemberwidget/lang/pl/messages.po index 90dda1ff..3f1838b5 100644 --- a/newmemberwidget/lang/pl/messages.po +++ b/newmemberwidget/lang/pl/messages.po @@ -10,10 +10,10 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" "Last-Translator: Piotr Strębski , 2022\n" -"Language-Team: Polish (http://app.transifex.com/Friendica/friendica/language/pl/)\n" +"Language-Team: Polish (http://www.transifex.com/Friendica/friendica/language/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,48 +29,48 @@ msgid "Tips for New Members" msgstr "Wskazówki dla nowych użytkowników" #: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "" +msgid "Global Support Forum" +msgstr "Globalne forum pomocy technicznej" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +msgid "Local Support Forum" +msgstr "Lokalne Forum Wsparcia" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Zapisz ustawienia" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Wiadomość" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "Twoja wiadomość dla nowych członków. Możesz tutaj użyć bbcode." -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" +msgstr "Dodaj odnośnik do globalnego forum pomocy technicznej" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" +msgstr "Czy powinien być wyświetlany odnośnik do globalnego forum pomocy technicznej?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" +msgstr "Dodaj odnośnik do lokalnego forum pomocy technicznej" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." -msgstr "" +msgstr "Jeżeli masz lokalne wsparcie forum i chcesz mieć łącze wyświetlane w widżecie, zaznacz to pole wyboru." -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "Nazwa grupy lokalnej pomocy technicznej" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/pl/strings.php b/newmemberwidget/lang/pl/strings.php index 22a9e9a9..97103add 100644 --- a/newmemberwidget/lang/pl/strings.php +++ b/newmemberwidget/lang/pl/strings.php @@ -7,8 +7,14 @@ function string_plural_select_pl($n){ }} $a->strings['New Member'] = 'Nowy użytkownik'; $a->strings['Tips for New Members'] = 'Wskazówki dla nowych użytkowników'; +$a->strings['Global Support Forum'] = 'Globalne forum pomocy technicznej'; +$a->strings['Local Support Forum'] = 'Lokalne Forum Wsparcia'; $a->strings['Save Settings'] = 'Zapisz ustawienia'; $a->strings['Message'] = 'Wiadomość'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Twoja wiadomość dla nowych członków. Możesz tutaj użyć bbcode.'; +$a->strings['Add a link to global support forum'] = 'Dodaj odnośnik do globalnego forum pomocy technicznej'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Czy powinien być wyświetlany odnośnik do globalnego forum pomocy technicznej?'; +$a->strings['Add a link to the local support forum'] = 'Dodaj odnośnik do lokalnego forum pomocy technicznej'; +$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Jeżeli masz lokalne wsparcie forum i chcesz mieć łącze wyświetlane w widżecie, zaznacz to pole wyboru.'; $a->strings['Name of the local support group'] = 'Nazwa grupy lokalnej pomocy technicznej'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Jeśli zaznaczyłeś powyższe, określ tutaj pseudonim lokalnej grupy wsparcia (np. Pomocnicy)'; diff --git a/newmemberwidget/lang/ru/messages.po b/newmemberwidget/lang/ru/messages.po index 1fe611e9..94d61e3f 100644 --- a/newmemberwidget/lang/ru/messages.po +++ b/newmemberwidget/lang/ru/messages.po @@ -9,67 +9,67 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" -"PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Alexander An , 2020\n" -"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"POT-Creation-Date: 2014-06-01 14:12+0200\n" +"PO-Revision-Date: 2020-04-23 14:23+0000\n" +"Last-Translator: Alexander An \n" +"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" -#: newmemberwidget.php:29 +#: newmemberwidget.php:21 msgid "New Member" msgstr "Новичок" -#: newmemberwidget.php:30 +#: newmemberwidget.php:22 msgid "Tips for New Members" msgstr "Советы новичкам" -#: newmemberwidget.php:33 -msgid "Global Support Group" -msgstr "" +#: newmemberwidget.php:24 +msgid "Global Support Forum" +msgstr "Общий форум поддержки" -#: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +#: newmemberwidget.php:26 +msgid "Local Support Forum" +msgstr "Местный форум поддержки" -#: newmemberwidget.php:62 +#: newmemberwidget.php:49 msgid "Save Settings" msgstr "Сохранить настройки" -#: newmemberwidget.php:63 +#: newmemberwidget.php:50 msgid "Message" msgstr "Сообщение" -#: newmemberwidget.php:63 +#: newmemberwidget.php:50 msgid "Your message for new members. You can use bbcode here." msgstr "Ваше сообщение новичкам. Вы можете использовать BBCode." -#: newmemberwidget.php:64 -msgid "Add a link to global support group" -msgstr "" +#: newmemberwidget.php:51 +msgid "Add a link to global support forum" +msgstr "Добавить ссылку на общий форум поддержки" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" -msgstr "" +#: newmemberwidget.php:51 +msgid "Should a link to the global support forum be displayed?" +msgstr "Показывать ссылку на общий форум поддержки?" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" -msgstr "" +#: newmemberwidget.php:52 +msgid "Add a link to the local support forum" +msgstr "Добавить ссылку на местный форум поддержки" -#: newmemberwidget.php:65 +#: newmemberwidget.php:52 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and wand to have a link displayed in the " "widget, check this box." -msgstr "" +msgstr "Если у вас есть местный форум поддержки и вы хотите добавить ссылку на него, включите это." -#: newmemberwidget.php:66 +#: newmemberwidget.php:53 msgid "Name of the local support group" msgstr "Название местной группы поддержки" -#: newmemberwidget.php:66 +#: newmemberwidget.php:53 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/ru/strings.php b/newmemberwidget/lang/ru/strings.php index 6f27bb1a..7992e64b 100644 --- a/newmemberwidget/lang/ru/strings.php +++ b/newmemberwidget/lang/ru/strings.php @@ -7,8 +7,14 @@ function string_plural_select_ru($n){ }} $a->strings['New Member'] = 'Новичок'; $a->strings['Tips for New Members'] = 'Советы новичкам'; +$a->strings['Global Support Forum'] = 'Общий форум поддержки'; +$a->strings['Local Support Forum'] = 'Местный форум поддержки'; $a->strings['Save Settings'] = 'Сохранить настройки'; $a->strings['Message'] = 'Сообщение'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Ваше сообщение новичкам. Вы можете использовать BBCode.'; +$a->strings['Add a link to global support forum'] = 'Добавить ссылку на общий форум поддержки'; +$a->strings['Should a link to the global support forum be displayed?'] = 'Показывать ссылку на общий форум поддержки?'; +$a->strings['Add a link to the local support forum'] = 'Добавить ссылку на местный форум поддержки'; +$a->strings['If you have a local support forum and wand to have a link displayed in the widget, check this box.'] = 'Если у вас есть местный форум поддержки и вы хотите добавить ссылку на него, включите это.'; $a->strings['Name of the local support group'] = 'Название местной группы поддержки'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Если вы включили настройку выше, укажите никместной группы поддержки пользователей.'; diff --git a/newmemberwidget/lang/sv/messages.po b/newmemberwidget/lang/sv/messages.po index a1a6167a..0d6171b2 100644 --- a/newmemberwidget/lang/sv/messages.po +++ b/newmemberwidget/lang/sv/messages.po @@ -9,10 +9,10 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-06-03 15:50-0400\n" -"PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Kristoffer Grundström , 2022\n" -"Language-Team: Swedish (http://app.transifex.com/Friendica/friendica/language/sv/)\n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2022-01-16 00:48+0000\n" +"Last-Translator: Kristoffer Grundström \n" +"Language-Team: Swedish (http://www.transifex.com/Friendica/friendica/language/sv/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -28,48 +28,48 @@ msgid "Tips for New Members" msgstr "Tips för nya medlemmar" #: newmemberwidget.php:33 -msgid "Global Support Group" +msgid "Global Support Forum" msgstr "" #: newmemberwidget.php:37 -msgid "Local Support Group" -msgstr "" +msgid "Local Support Forum" +msgstr "Lokalt hjälpforum" -#: newmemberwidget.php:62 +#: newmemberwidget.php:65 msgid "Save Settings" msgstr "Spara inställningar" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Message" msgstr "Meddelande" -#: newmemberwidget.php:63 +#: newmemberwidget.php:66 msgid "Your message for new members. You can use bbcode here." msgstr "" -#: newmemberwidget.php:64 -msgid "Add a link to global support group" +#: newmemberwidget.php:67 +msgid "Add a link to global support forum" msgstr "" -#: newmemberwidget.php:64 -msgid "Should a link to the global support group be displayed?" +#: newmemberwidget.php:67 +msgid "Should a link to the global support forum be displayed?" msgstr "" -#: newmemberwidget.php:65 -msgid "Add a link to the local support group" +#: newmemberwidget.php:68 +msgid "Add a link to the local support forum" msgstr "" -#: newmemberwidget.php:65 +#: newmemberwidget.php:68 msgid "" -"If you have a local support group and want to have a link displayed in the " +"If you have a local support forum and want to have a link displayed in the " "widget, check this box." msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "Name of the local support group" msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:69 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/sv/strings.php b/newmemberwidget/lang/sv/strings.php index e92a428f..38292306 100644 --- a/newmemberwidget/lang/sv/strings.php +++ b/newmemberwidget/lang/sv/strings.php @@ -7,5 +7,6 @@ function string_plural_select_sv($n){ }} $a->strings['New Member'] = 'Ny medlem'; $a->strings['Tips for New Members'] = 'Tips för nya medlemmar'; +$a->strings['Local Support Forum'] = 'Lokalt hjälpforum'; $a->strings['Save Settings'] = 'Spara inställningar'; $a->strings['Message'] = 'Meddelande'; diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index ba7dfb39..6cd79c37 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -6,16 +6,17 @@ * Author: Tobias Diekershoff ***/ +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; +use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Model\User; function newmemberwidget_install() { Hook::register( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); - DI::logger()->notice('newmemberwidget installed'); + Logger::notice('newmemberwidget installed'); } function newmemberwidget_network_mod_init ($b) @@ -38,7 +39,7 @@ function newmemberwidget_network_mod_init ($b) $ft = DI::config()->get('newmemberwidget','freetext', ''); if (!empty($ft)) { - $t .= '

'.BBCode::convertForUriId(User::getSystemUriId(), trim($ft)).'

'; + $t .= '

'.BBCode::convert(trim($ft)).'

'; } $t .= '
'; diff --git a/nitter/nitter.php b/nitter/nitter.php index adbfd6b0..e9454c5d 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -4,20 +4,18 @@ * Description: Replaces links to twitter.com to a nitter server in all displays of postings on a node. * Version: 2.0 * Author: Tobias Diekershoff - * Status: Unsupported - * Note: Please use the URL Replace addon instead * * Copyright (c) 2020 Tobias Diekershoff * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * 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, @@ -25,6 +23,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -50,7 +49,7 @@ function nitter_addon_admin(string &$o) $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nitter/'); $o = Renderer::replaceMacros($t, [ '$settingdescription' => DI::l10n()->t('Which nitter server shall be used for the replacements in the post bodies? Use the URL with servername and protocol. See %s for a list of available public Nitter servers.', 'https://github.com/zedeus/nitter/wiki/Instances'), - '$nitterserver' => ['nitterserver', DI::l10n()->t('Nitter server'), $nitterserver, 'https://example.com'], + '$nitterserver' => ['nitterserver', DI::l10n()->t('Nitter server'), $nitterserver, 'https://example.com'], '$submit' => DI::l10n()->t('Save Settings'), ]); } diff --git a/nominatim/nominatim.php b/nominatim/nominatim.php index 3a567b7b..6ad4a8a3 100644 --- a/nominatim/nominatim.php +++ b/nominatim/nominatim.php @@ -6,7 +6,9 @@ * Author: Michael Vogel */ +use Friendica\App; use Friendica\Core\Hook; +use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -44,19 +46,19 @@ function nominatim_resolve_item(array &$item) $s = DI::httpClient()->fetch('https://nominatim.openstreetmap.org/reverse?lat=' . $coords[0] . '&lon=' . $coords[1] . '&format=json&addressdetails=0&accept-language=' . $language); if (empty($s)) { - DI::logger()->info('API could not be queried'); + Logger::info('API could not be queried'); return; } $data = json_decode($s, true); if (empty($data['display_name'])) { - DI::logger()->info('No results found for coordinates', ['coordinates' => $item['coord'], 'data' => $data]); + Logger::info('No results found for coordinates', ['coordinates' => $item['coord'], 'data' => $data]); return; } $item['location'] = $data['display_name']; - DI::logger()->info('Got location', ['lat' => $coords[0], 'long' => $coords[1], 'location' => $item['location']]); + Logger::info('Got location', ['lat' => $coords[0], 'long' => $coords[1], 'location' => $item['location']]); if (!empty($item['location'])) { DI::cache()->set('nominatim:' . $language . ':' . $coords[0] . '-' . $coords[1], $item['location']); diff --git a/notifyall/NotifyAllEmail.php b/notifyall/NotifyAllEmail.php index 7a00a2c9..3bb16f27 100644 --- a/notifyall/NotifyAllEmail.php +++ b/notifyall/NotifyAllEmail.php @@ -25,7 +25,6 @@ use Friendica\App\BaseURL; use Friendica\Content\Text\BBCode; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; -use Friendica\Model\User; use Friendica\Object\Email; /** @@ -51,9 +50,9 @@ class NotifyAllEmail extends Email $subject = $_REQUEST['subject']; - $textversion = strip_tags(html_entity_decode(BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8')); + $textversion = strip_tags(html_entity_decode(BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8')); - $htmlversion = BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "
\n"], $text))); + $htmlversion = BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "
\n"], $text))); parent::__construct($sender_name, $sender_email, $sender_email, '', $subject, $htmlversion, $textversion); } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index f814c4f5..966a9184 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -9,7 +9,9 @@ */ use Friendica\Addon\notifyall\NotifyAllEmail; +use Friendica\App; use Friendica\Database\DBA; +use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -57,7 +59,7 @@ function notifyall_post() $notifyEmail = new NotifyAllEmail(DI::l10n(), DI::config(), DI::baseUrl(), $text); - foreach (DBA::toArray($recipients) as $recipient) { + foreach ($recipients as $recipient) { DI::emailer()->send($notifyEmail->withRecipient($recipient['email'])); } diff --git a/nsfw/lang/fr/messages.po b/nsfw/lang/fr/messages.po index 2af1c3d4..5748f90a 100644 --- a/nsfw/lang/fr/messages.po +++ b/nsfw/lang/fr/messages.po @@ -4,7 +4,6 @@ # # # Translators: -# cracrayol, 2023-2024 # Nicolas Derive, 2022-2023 # StefOfficiel , 2015 # Vincent Vindarel , 2018 @@ -14,7 +13,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-12-10 14:42-0500\n" "PO-Revision-Date: 2014-06-23 10:34+0000\n" -"Last-Translator: cracrayol, 2023-2024\n" +"Last-Translator: Nicolas Derive, 2022-2023\n" "Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -42,7 +41,7 @@ msgstr "Liste de mots-clés - séparés par des virgules - à cacher" msgid "" "Use /expression/ to provide regular expressions, #tag to specfically match " "hashtags (case-insensitive), or regular words (case-sensitive)" -msgstr "Utiliser /expression/ pour fournir des expressions régulières, #etiquette pour correspondre à une étiquette (insensible à la casse), ou des mots classiques (sensible à la casse)" +msgstr "Utiliser /expression/ pour fournir des expressions régulières, #tag pour correspondre à un mot-dièse (hashtag, insensible à la casse), ou des mots classiques (sensible à la casse)" #: nsfw.php:72 msgid "Content Filter (NSFW and more)" @@ -56,7 +55,7 @@ msgstr "La compilation de l'expression régulière \"%s\" a échoué" #: nsfw.php:154 #, php-format msgid "Filtered tag: %s" -msgstr "Tag filtré : %s" +msgstr "Tag filtré: %s" #: nsfw.php:156 #, php-format diff --git a/nsfw/lang/fr/strings.php b/nsfw/lang/fr/strings.php index 0f717797..ee3734ec 100644 --- a/nsfw/lang/fr/strings.php +++ b/nsfw/lang/fr/strings.php @@ -8,8 +8,8 @@ function string_plural_select_fr($n){ $a->strings['This addon searches for specified words/text in posts and collapses them. It can be used to filter content tagged with for instance #NSFW that may be deemed inappropriate at certain times or places, such as being at work. It is also useful for hiding irrelevant or annoying content from direct view.'] = 'Cette extension recherche des mots/textes spécifiés dans les publications et les masque. Elle peut être utilisée pour filtrer le contenu étiqueté par exemple avec #NSFW qui peut être considéré comme inapproprié à certains moments ou endroits, comme par exemple au travail. Elle est aussi utile pour cacher du contenu non pertinent ou ennuyeux d\'une vue directe.'; $a->strings['Enable Content filter'] = 'Activer le filtrage de contenu'; $a->strings['Comma separated list of keywords to hide'] = 'Liste de mots-clés - séparés par des virgules - à cacher'; -$a->strings['Use /expression/ to provide regular expressions, #tag to specfically match hashtags (case-insensitive), or regular words (case-sensitive)'] = 'Utiliser /expression/ pour fournir des expressions régulières, #etiquette pour correspondre à une étiquette (insensible à la casse), ou des mots classiques (sensible à la casse)'; +$a->strings['Use /expression/ to provide regular expressions, #tag to specfically match hashtags (case-insensitive), or regular words (case-sensitive)'] = 'Utiliser /expression/ pour fournir des expressions régulières, #tag pour correspondre à un mot-dièse (hashtag, insensible à la casse), ou des mots classiques (sensible à la casse)'; $a->strings['Content Filter (NSFW and more)'] = 'Filtre de contenu (NSFW et autres)'; $a->strings['Regular expression "%s" fails to compile'] = 'La compilation de l\'expression régulière "%s" a échoué'; -$a->strings['Filtered tag: %s'] = 'Tag filtré : %s'; +$a->strings['Filtered tag: %s'] = 'Tag filtré: %s'; $a->strings['Filtered word: %s'] = 'Mot filtré: %s'; diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 37d34d7d..4a54d899 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -8,6 +8,7 @@ * */ +use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -104,13 +105,12 @@ function nsfw_addon_settings_post(array &$b) function nsfw_prepare_body_content_filter(&$hook_data) { $words = null; - $uid = $hook_data['uid'] ?? DI::userSession()->getLocalUserId(); - if (DI::pConfig()->get($uid, 'nsfw', 'disable')) { + if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'disable')) { return; } - if ($uid) { - $words = DI::pConfig()->get($uid, 'nsfw', 'words'); + if (DI::userSession()->getLocalUserId()) { + $words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'words'); } if ($words) { @@ -119,9 +119,7 @@ function nsfw_prepare_body_content_filter(&$hook_data) $word_list = ['nsfw']; } - $found = false; - $tag_search = false; - + $found = false; if (count($word_list)) { $body = $hook_data['item']['title'] . "\n" . nsfw_extract_photos($hook_data['item']['body']); @@ -131,16 +129,17 @@ function nsfw_prepare_body_content_filter(&$hook_data) continue; } + $tag_search = false; switch ($word[0]) { case '/'; // Regular expression $found = @preg_match($word, $body); break; case '#': // Hashtag-only search $tag_search = true; - $found = nsfw_find_word_in_item_tags($hook_data['item']['hashtags'] ?? [], substr($word, 1)); + $found = nsfw_find_word_in_item_tags($hook_data['item']['hashtags'], substr($word, 1)); break; default: - $found = strpos($body, $word) !== false || nsfw_find_word_in_item_tags($hook_data['item']['tags'] ?? [], $word); + $found = strpos($body, $word) !== false || nsfw_find_word_in_item_tags($hook_data['item']['tags'], $word); break; } diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 5652c8f0..538a4a3e 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -6,7 +6,9 @@ * Author: Mike Macgirvin */ +use Friendica\App; use Friendica\Core\Hook; +use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -15,7 +17,7 @@ function numfriends_install() { Hook::register('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); Hook::register('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); - DI::logger()->notice("installed numfriends"); + Logger::notice("installed numfriends"); } /** @@ -37,7 +39,7 @@ function numfriends_settings_post($post) { /** * - * Called from the Addon Setting form. + * Called from the Addon Setting form. * Add our own settings info to the page. * */ @@ -48,7 +50,7 @@ function numfriends_settings(array &$data) } $numfriends = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'display_friend_count', 24); - + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/numfriends/'); $html = Renderer::replaceMacros($t, [ '$numfriends' => ['numfriends', DI::l10n()->t('How many contacts to display on profile sidebar'), $numfriends], diff --git a/openstreetmap/config/openstreetmap.config.php b/openstreetmap/config/openstreetmap.config.php index d633fd26..c649da5f 100644 --- a/openstreetmap/config/openstreetmap.config.php +++ b/openstreetmap/config/openstreetmap.config.php @@ -10,7 +10,7 @@ return [ 'tmsserver' => 'https://www.openstreetmap.org', // nomserver (String) - 'nomserver' => 'https://nominatim.openstreetmap.org/search', + 'nomserver' => 'https://nominatim.openstreetmap.org/search.php', // zoom (Integer) // The default zoom level on the map. diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index bf0f54b6..3b7c4a58 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -9,8 +9,10 @@ * */ +use Friendica\App; use Friendica\Core\Cache\Enum\Duration; use Friendica\Core\Hook; +use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Core\Config\Util\ConfigFileManager; @@ -30,12 +32,12 @@ function openstreetmap_install() Hook::register('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates'); Hook::register('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader'); - DI::logger()->notice("installed openstreetmap"); + Logger::notice("installed openstreetmap"); } function openstreetmap_load_config(ConfigFileManager $loader) { - DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } function openstreetmap_alterheader(&$navHtml) @@ -119,7 +121,7 @@ function openstreetmap_get_coordinates(array &$b) if (is_null($j)) { $curlResult = DI::httpClient()->get($nomserver . $args); if ($curlResult->isSuccess()) { - $j = json_decode($curlResult->getBodyString(), true); + $j = json_decode($curlResult->getBody(), true); DI::cache()->set($cachekey, $j, Duration::MONTH); } } @@ -153,8 +155,8 @@ function openstreetmap_generate_map(array &$b) $lat = $b['lat']; // round($b['lat'], 5); $lon = $b['lon']; // round($b['lon'], 5); - DI::logger()->debug('lat: ' . $lat); - DI::logger()->debug('lon: ' . $lon); + Logger::debug('lat: ' . $lat); + Logger::debug('lon: ' . $lon); $cardlink = '=7.0", - "phpmailer/phpmailer": "^6.1" - }, - "license": "3-clause BSD license", - "minimum-stability": "stable", - "config": { - "optimize-autoloader": true, - "autoloader-suffix": "PhpMailerAddon", - "preferred-install": "dist" - } + "name": "friendica-addons/phpmailer", + "description": "Replaces the default `mail()` function by the `PHPMailer` library", + "type": "friendica-addon", + "authors": [ + { + "name": "Marcus Mueller", + "role": "Developer" + } + ], + "require": { + "php": ">=7.0", + "phpmailer/phpmailer": "^6.1" + }, + "license": "3-clause BSD license", + "minimum-stability": "stable", + "config": { + "optimize-autoloader": true, + "autoloader-suffix": "PhpMailerAddon", + "preferred-install": "dist" + } } diff --git a/phpmailer/composer.lock b/phpmailer/composer.lock index 7cd1afd5..b1f2a5d9 100644 --- a/phpmailer/composer.lock +++ b/phpmailer/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "phpmailer/phpmailer", - "version": "v6.10.0", + "version": "v6.5.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144" + "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", - "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c", + "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c", "shasum": "" }, "require": { @@ -27,25 +27,20 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/annotations": "^1.2.6 || ^1.13.3", - "php-parallel-lint/php-console-highlighter": "^1.0.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "doctrine/annotations": "^1.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.2", - "yoast/phpunit-polyfills": "^1.0.4" + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { - "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", - "ext-openssl": "Needed for secure SMTP sending and DKIM signing", - "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", - "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" + "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" }, "type": "library", "autoload": { @@ -77,7 +72,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.10.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0" }, "funding": [ { @@ -85,18 +80,18 @@ "type": "github" } ], - "time": "2025-04-24T15:19:31+00:00" + "time": "2021-06-16T14:33:43+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7.0" }, - "platform-dev": {}, - "plugin-api-version": "2.6.0" + "platform-dev": [], + "plugin-api-version": "2.1.0" } diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index 10287a04..4c12709d 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -7,6 +7,7 @@ * Maintainer: Hypolite Petovan */ +use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; use Friendica\Object\EMail\IEmail; @@ -24,18 +25,14 @@ function phpmailer_install() function phpmailer_load_config(ConfigFileManager $loader) { - DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } /** - * @param null|IEmail $email + * @param IEmail $email */ -function phpmailer_emailer_send_prepare(?IEmail &$email) +function phpmailer_emailer_send_prepare(IEmail &$email) { - if ($email === null) { - return; - } - // Passing `true` enables exceptions $mailer = new PHPMailer(true); try { diff --git a/phpmailer/vendor/autoload.php b/phpmailer/vendor/autoload.php index 1d45b283..60925835 100644 --- a/phpmailer/vendor/autoload.php +++ b/phpmailer/vendor/autoload.php @@ -2,24 +2,6 @@ // autoload.php @generated by Composer -if (PHP_VERSION_ID < 50600) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, $err); - } elseif (!headers_sent()) { - echo $err; - } - } - trigger_error( - $err, - E_USER_ERROR - ); -} - require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInitPhpMailerAddon::getLoader(); diff --git a/phpmailer/vendor/composer/ClassLoader.php b/phpmailer/vendor/composer/ClassLoader.php index 7824d8f7..03b9bb9c 100644 --- a/phpmailer/vendor/composer/ClassLoader.php +++ b/phpmailer/vendor/composer/ClassLoader.php @@ -37,81 +37,26 @@ namespace Composer\Autoload; * * @author Fabien Potencier * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ */ class ClassLoader { - /** @var \Closure(string):void */ - private static $includeFile; - - /** @var string|null */ - private $vendorDir; - // PSR-4 - /** - * @var array> - */ private $prefixLengthsPsr4 = array(); - /** - * @var array> - */ private $prefixDirsPsr4 = array(); - /** - * @var list - */ private $fallbackDirsPsr4 = array(); // PSR-0 - /** - * List of PSR-0 prefixes - * - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) - * - * @var array>> - */ private $prefixesPsr0 = array(); - /** - * @var list - */ private $fallbackDirsPsr0 = array(); - /** @var bool */ private $useIncludePath = false; - - /** - * @var array - */ private $classMap = array(); - - /** @var bool */ private $classMapAuthoritative = false; - - /** - * @var array - */ private $missingClasses = array(); - - /** @var string|null */ private $apcuPrefix; - /** - * @var array - */ - private static $registeredLoaders = array(); - - /** - * @param string|null $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - self::initializeIncludeClosure(); - } - - /** - * @return array> - */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { @@ -121,42 +66,28 @@ class ClassLoader return array(); } - /** - * @return array> - */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } - /** - * @return list - */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } - /** - * @return list - */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } - /** - * @return array Array of classname => path - */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map - * - * @return void + * @param array $classMap Class to filename map */ public function addClassMap(array $classMap) { @@ -171,25 +102,22 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories */ public function add($prefix, $paths, $prepend = false) { - $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - $paths, + (array) $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - $paths + (array) $paths ); } @@ -198,19 +126,19 @@ class ClassLoader $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = $paths; + $this->prefixesPsr0[$first][$prefix] = (array) $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - $paths, + (array) $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - $paths + (array) $paths ); } } @@ -219,28 +147,25 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException - * - * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { - $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - $paths, + (array) $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - $paths + (array) $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -250,18 +175,18 @@ class ClassLoader throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = $paths; + $this->prefixDirsPsr4[$prefix] = (array) $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - $paths, + (array) $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - $paths + (array) $paths ); } } @@ -270,10 +195,8 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param list|string $paths The PSR-0 base directories - * - * @return void + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories */ public function set($prefix, $paths) { @@ -288,12 +211,10 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param list|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException - * - * @return void */ public function setPsr4($prefix, $paths) { @@ -313,8 +234,6 @@ class ClassLoader * Turns on searching the include path for class files. * * @param bool $useIncludePath - * - * @return void */ public function setUseIncludePath($useIncludePath) { @@ -337,8 +256,6 @@ class ClassLoader * that have not been registered with the class map. * * @param bool $classMapAuthoritative - * - * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -359,8 +276,6 @@ class ClassLoader * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix - * - * @return void */ public function setApcuPrefix($apcuPrefix) { @@ -381,55 +296,33 @@ class ClassLoader * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not - * - * @return void */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } } /** * Unregisters this instance as an autoloader. - * - * @return void */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } } /** * Loads the given class or interface. * * @param string $class The name of the class - * @return true|null True if loaded, null otherwise + * @return bool|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { - $includeFile = self::$includeFile; - $includeFile($file); + includeFile($file); return true; } - - return null; } /** @@ -474,21 +367,6 @@ class ClassLoader return $file; } - /** - * Returns the currently registered loaders keyed by their corresponding vendor directories. - * - * @return array - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -554,26 +432,14 @@ class ClassLoader return false; } - - /** - * @return void - */ - private static function initializeIncludeClosure() - { - if (self::$includeFile !== null) { - return; - } - - /** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - */ - self::$includeFile = \Closure::bind(static function($file) { - include $file; - }, null, null); - } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; } diff --git a/phpmailer/vendor/composer/InstalledVersions.php b/phpmailer/vendor/composer/InstalledVersions.php deleted file mode 100644 index 51e734a7..00000000 --- a/phpmailer/vendor/composer/InstalledVersions.php +++ /dev/null @@ -1,359 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer; - -use Composer\Autoload\ClassLoader; -use Composer\Semver\VersionParser; - -/** - * This class is copied in every Composer installed project and available to all - * - * See also https://getcomposer.org/doc/07-runtime.md#installed-versions - * - * To require its presence, you can require `composer-runtime-api ^2.0` - * - * @final - */ -class InstalledVersions -{ - /** - * @var mixed[]|null - * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null - */ - private static $installed; - - /** - * @var bool|null - */ - private static $canGetVendors; - - /** - * @var array[] - * @psalm-var array}> - */ - private static $installedByVendor = array(); - - /** - * Returns a list of all package names which are present, either by being installed, replaced or provided - * - * @return string[] - * @psalm-return list - */ - public static function getInstalledPackages() - { - $packages = array(); - foreach (self::getInstalled() as $installed) { - $packages[] = array_keys($installed['versions']); - } - - if (1 === \count($packages)) { - return $packages[0]; - } - - return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); - } - - /** - * Returns a list of all package names with a specific type e.g. 'library' - * - * @param string $type - * @return string[] - * @psalm-return list - */ - public static function getInstalledPackagesByType($type) - { - $packagesByType = array(); - - foreach (self::getInstalled() as $installed) { - foreach ($installed['versions'] as $name => $package) { - if (isset($package['type']) && $package['type'] === $type) { - $packagesByType[] = $name; - } - } - } - - return $packagesByType; - } - - /** - * Checks whether the given package is installed - * - * This also returns true if the package name is provided or replaced by another package - * - * @param string $packageName - * @param bool $includeDevRequirements - * @return bool - */ - public static function isInstalled($packageName, $includeDevRequirements = true) - { - foreach (self::getInstalled() as $installed) { - if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; - } - } - - return false; - } - - /** - * Checks whether the given package satisfies a version constraint - * - * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: - * - * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') - * - * @param VersionParser $parser Install composer/semver to have access to this class and functionality - * @param string $packageName - * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package - * @return bool - */ - public static function satisfies(VersionParser $parser, $packageName, $constraint) - { - $constraint = $parser->parseConstraints((string) $constraint); - $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); - - return $provided->matches($constraint); - } - - /** - * Returns a version constraint representing all the range(s) which are installed for a given package - * - * It is easier to use this via isInstalled() with the $constraint argument if you need to check - * whether a given version of a package is installed, and not just whether it exists - * - * @param string $packageName - * @return string Version constraint usable with composer/semver - */ - public static function getVersionRanges($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - $ranges = array(); - if (isset($installed['versions'][$packageName]['pretty_version'])) { - $ranges[] = $installed['versions'][$packageName]['pretty_version']; - } - if (array_key_exists('aliases', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); - } - if (array_key_exists('replaced', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); - } - if (array_key_exists('provided', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); - } - - return implode(' || ', $ranges); - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['version'])) { - return null; - } - - return $installed['versions'][$packageName]['version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getPrettyVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['pretty_version'])) { - return null; - } - - return $installed['versions'][$packageName]['pretty_version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference - */ - public static function getReference($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['reference'])) { - return null; - } - - return $installed['versions'][$packageName]['reference']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. - */ - public static function getInstallPath($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @return array - * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} - */ - public static function getRootPackage() - { - $installed = self::getInstalled(); - - return $installed[0]['root']; - } - - /** - * Returns the raw installed.php data for custom implementations - * - * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. - * @return array[] - * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} - */ - public static function getRawData() - { - @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = include __DIR__ . '/installed.php'; - } else { - self::$installed = array(); - } - } - - return self::$installed; - } - - /** - * Returns the raw data of all installed.php which are currently loaded for custom implementations - * - * @return array[] - * @psalm-return list}> - */ - public static function getAllRawData() - { - return self::getInstalled(); - } - - /** - * Lets you reload the static array from another file - * - * This is only useful for complex integrations in which a project needs to use - * this class but then also needs to execute another project's autoloader in process, - * and wants to ensure both projects have access to their version of installed.php. - * - * A typical case would be PHPUnit, where it would need to make sure it reads all - * the data it needs from this class, then call reload() with - * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure - * the project in which it runs can then also use this class safely, without - * interference between PHPUnit's dependencies and the project's dependencies. - * - * @param array[] $data A vendor/composer/installed.php data set - * @return void - * - * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data - */ - public static function reload($data) - { - self::$installed = $data; - self::$installedByVendor = array(); - } - - /** - * @return array[] - * @psalm-return list}> - */ - private static function getInstalled() - { - if (null === self::$canGetVendors) { - self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); - } - - $installed = array(); - - if (self::$canGetVendors) { - foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { - if (isset(self::$installedByVendor[$vendorDir])) { - $installed[] = self::$installedByVendor[$vendorDir]; - } elseif (is_file($vendorDir.'/composer/installed.php')) { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; - } - } - } - } - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ - $required = require __DIR__ . '/installed.php'; - self::$installed = $required; - } else { - self::$installed = array(); - } - } - - if (self::$installed !== array()) { - $installed[] = self::$installed; - } - - return $installed; - } -} diff --git a/phpmailer/vendor/composer/autoload_classmap.php b/phpmailer/vendor/composer/autoload_classmap.php index c20440c1..6000382d 100644 --- a/phpmailer/vendor/composer/autoload_classmap.php +++ b/phpmailer/vendor/composer/autoload_classmap.php @@ -2,15 +2,12 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'PHPMailer\\PHPMailer\\DSNConfigurator' => $vendorDir . '/phpmailer/phpmailer/src/DSNConfigurator.php', 'PHPMailer\\PHPMailer\\Exception' => $vendorDir . '/phpmailer/phpmailer/src/Exception.php', 'PHPMailer\\PHPMailer\\OAuth' => $vendorDir . '/phpmailer/phpmailer/src/OAuth.php', - 'PHPMailer\\PHPMailer\\OAuthTokenProvider' => $vendorDir . '/phpmailer/phpmailer/src/OAuthTokenProvider.php', 'PHPMailer\\PHPMailer\\PHPMailer' => $vendorDir . '/phpmailer/phpmailer/src/PHPMailer.php', 'PHPMailer\\PHPMailer\\POP3' => $vendorDir . '/phpmailer/phpmailer/src/POP3.php', 'PHPMailer\\PHPMailer\\SMTP' => $vendorDir . '/phpmailer/phpmailer/src/SMTP.php', diff --git a/phpmailer/vendor/composer/autoload_namespaces.php b/phpmailer/vendor/composer/autoload_namespaces.php index 15a2ff3a..b7fc0125 100644 --- a/phpmailer/vendor/composer/autoload_namespaces.php +++ b/phpmailer/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/phpmailer/vendor/composer/autoload_psr4.php b/phpmailer/vendor/composer/autoload_psr4.php index 28567a00..0706da6f 100644 --- a/phpmailer/vendor/composer/autoload_psr4.php +++ b/phpmailer/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/phpmailer/vendor/composer/autoload_real.php b/phpmailer/vendor/composer/autoload_real.php index 65adf3da..e7e97ae8 100644 --- a/phpmailer/vendor/composer/autoload_real.php +++ b/phpmailer/vendor/composer/autoload_real.php @@ -22,14 +22,31 @@ class ComposerAutoloaderInitPhpMailerAddon return self::$loader; } - require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitPhpMailerAddon', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInitPhpMailerAddon', 'loadClassLoader')); - require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitPhpMailerAddon::getInitializer($loader)); + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitPhpMailerAddon::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } $loader->register(true); diff --git a/phpmailer/vendor/composer/autoload_static.php b/phpmailer/vendor/composer/autoload_static.php index 8fc70b40..20cd9684 100644 --- a/phpmailer/vendor/composer/autoload_static.php +++ b/phpmailer/vendor/composer/autoload_static.php @@ -21,11 +21,8 @@ class ComposerStaticInitPhpMailerAddon ); public static $classMap = array ( - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'PHPMailer\\PHPMailer\\DSNConfigurator' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/DSNConfigurator.php', 'PHPMailer\\PHPMailer\\Exception' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/Exception.php', 'PHPMailer\\PHPMailer\\OAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuth.php', - 'PHPMailer\\PHPMailer\\OAuthTokenProvider' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuthTokenProvider.php', 'PHPMailer\\PHPMailer\\PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/PHPMailer.php', 'PHPMailer\\PHPMailer\\POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/POP3.php', 'PHPMailer\\PHPMailer\\SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/SMTP.php', diff --git a/phpmailer/vendor/composer/installed.json b/phpmailer/vendor/composer/installed.json index 142a295b..20714abc 100644 --- a/phpmailer/vendor/composer/installed.json +++ b/phpmailer/vendor/composer/installed.json @@ -1,90 +1,80 @@ -{ - "packages": [ - { - "name": "phpmailer/phpmailer", - "version": "v6.10.0", - "version_normalized": "6.10.0.0", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", - "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-filter": "*", - "ext-hash": "*", - "php": ">=5.5.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/annotations": "^1.2.6 || ^1.13.3", - "php-parallel-lint/php-console-highlighter": "^1.0.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", - "phpcompatibility/php-compatibility": "^9.3.5", - "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.2", - "yoast/phpunit-polyfills": "^1.0.4" - }, - "suggest": { - "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", - "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", - "ext-openssl": "Needed for secure SMTP sending and DKIM signing", - "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", - "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", - "league/oauth2-google": "Needed for Google XOAUTH2 authentication", - "psr/log": "For optional PSR-3 debug logging", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", - "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" - }, - "time": "2025-04-24T15:19:31+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "PHPMailer\\PHPMailer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-only" - ], - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "support": { - "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.10.0" - }, - "funding": [ - { - "url": "https://github.com/Synchro", - "type": "github" - } - ], - "install-path": "../phpmailer/phpmailer" - } +[ + { + "name": "phpmailer/phpmailer", + "version": "v6.5.0", + "version_normalized": "6.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c", + "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-filter": "*", + "ext-hash": "*", + "php": ">=5.5.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "doctrine/annotations": "^1.2", + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" + }, + "suggest": { + "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "league/oauth2-google": "Needed for Google XOAUTH2 authentication", + "psr/log": "For optional PSR-3 debug logging", + "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" + }, + "time": "2021-06-16T14:33:43+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "PHPMailer\\PHPMailer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-only" ], - "dev": true, - "dev-package-names": [] -} + "authors": [ + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "support": { + "issues": "https://github.com/PHPMailer/PHPMailer/issues", + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0" + }, + "funding": [ + { + "url": "https://github.com/Synchro", + "type": "github" + } + ] + } +] diff --git a/phpmailer/vendor/composer/installed.php b/phpmailer/vendor/composer/installed.php deleted file mode 100644 index 554d2c40..00000000 --- a/phpmailer/vendor/composer/installed.php +++ /dev/null @@ -1,32 +0,0 @@ - array( - 'name' => 'friendica-addons/phpmailer', - 'pretty_version' => 'dev-2025.07-rc', - 'version' => 'dev-2025.07-rc', - 'reference' => '715f70032330ad14f710284104c8593c7800e125', - 'type' => 'friendica-addon', - 'install_path' => __DIR__ . '/../../', - 'aliases' => array(), - 'dev' => true, - ), - 'versions' => array( - 'friendica-addons/phpmailer' => array( - 'pretty_version' => 'dev-2025.07-rc', - 'version' => 'dev-2025.07-rc', - 'reference' => '715f70032330ad14f710284104c8593c7800e125', - 'type' => 'friendica-addon', - 'install_path' => __DIR__ . '/../../', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'phpmailer/phpmailer' => array( - 'pretty_version' => 'v6.10.0', - 'version' => '6.10.0.0', - 'reference' => 'bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144', - 'type' => 'library', - 'install_path' => __DIR__ . '/../phpmailer/phpmailer', - 'aliases' => array(), - 'dev_requirement' => false, - ), - ), -); diff --git a/phpmailer/vendor/composer/platform_check.php b/phpmailer/vendor/composer/platform_check.php deleted file mode 100644 index f79e574b..00000000 --- a/phpmailer/vendor/composer/platform_check.php +++ /dev/null @@ -1,26 +0,0 @@ -= 70000)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.'; -} - -if ($issues) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); - } elseif (!headers_sent()) { - echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; - } - } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR - ); -} diff --git a/phpmailer/vendor/phpmailer/phpmailer/README.md b/phpmailer/vendor/phpmailer/phpmailer/README.md index 862a4e1a..fa27d2f6 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/README.md +++ b/phpmailer/vendor/phpmailer/phpmailer/README.md @@ -1,54 +1,45 @@ -[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://supportukrainenow.org/) - ![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png) # PHPMailer – A full-featured email creation and transfer class for PHP -[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions) -[![codecov.io](https://codecov.io/gh/PHPMailer/PHPMailer/branch/master/graph/badge.svg?token=iORZpwmYmM)](https://codecov.io/gh/PHPMailer/PHPMailer) -[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) -[![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) -[![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) -[![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/PHPMailer/PHPMailer/badge)](https://api.securityscorecards.dev/projects/github.com/PHPMailer/PHPMailer) +[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions) [![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/) ## Features - Probably the world's most popular code for sending email from PHP! - Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more - Integrated SMTP support – send without a local mail server -- Send emails with multiple To, CC, BCC, and Reply-to addresses +- Send emails with multiple To, CC, BCC and Reply-to addresses - Multipart/alternative emails for mail clients that do not read HTML email - Add attachments, including inline - Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings -- Full UTF-8 support when using servers that support `SMTPUTF8`. -- Support for iCal events in multiparts and attachments -- SMTP authentication with `LOGIN`, `PLAIN`, `CRAM-MD5`, and `XOAUTH2` mechanisms over SMTPS and SMTP+STARTTLS transports +- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SMTPS and SMTP+STARTTLS transports - Validates email addresses automatically - Protects against header injection attacks - Error messages in over 50 languages! - DKIM and S/MIME signing support -- Compatible with PHP 5.5 and later, including PHP 8.4 +- Compatible with PHP 5.5 and later, including PHP 8.0 - Namespaced to prevent name clashes - Much more! ## Why you might need it -Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as authentication, HTML messages, and attachments. +Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments. Formatting email correctly is surprisingly difficult. There are myriad overlapping (and conflicting) standards, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong, if not unsafe! The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP client allows email sending on all platforms without needing a local mail server. Be aware though, that the `mail()` function should be avoided when possible; it's both faster and [safer](https://exploitbox.io/paper/Pwning-PHP-Mail-Function-For-Fun-And-RCE.html) to use SMTP to localhost. *Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that -you should look at before rolling your own. Try [Symfony Mailer](https://symfony.com/doc/current/mailer.html), [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail), etc. +you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/) +, [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc. ## License -This software is distributed under the [LGPL 2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution. +This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution. ## Installation & loading PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file: ```json -"phpmailer/phpmailer": "^6.10.0" +"phpmailer/phpmailer": "^6.2" ``` or run @@ -59,8 +50,7 @@ composer require phpmailer/phpmailer Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer; they are not part of PHPMailer. -If you want to use XOAUTH2 authentication, you will also need to add a dependency on the `league/oauth2-client` and appropriate service adapters package in your `composer.json`, or take a look at -by @decomplexity's [SendOauth2 wrapper](https://github.com/decomplexity/SendOauth2), especially if you're using Microsoft services. +If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`. Alternatively, if you're not using Composer, you can [download PHPMailer as a zip file](https://github.com/PHPMailer/PHPMailer/archive/master.zip), (note that docs and examples are not included in the zip file), then copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually: @@ -75,7 +65,7 @@ require 'path/to/PHPMailer/src/PHPMailer.php'; require 'path/to/PHPMailer/src/SMTP.php'; ``` -If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for it. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally. +If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally. ## Legacy versions PHPMailer 5.2 (which is compatible with PHP 5.0 — 7.0) is no longer supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases. @@ -96,10 +86,10 @@ use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; -//Load Composer's autoloader (created by composer, not included with PHPMailer) +//Load Composer's autoloader require 'vendor/autoload.php'; -//Create an instance; passing `true` enables exceptions +//Instantiation and passing `true` enables exceptions $mail = new PHPMailer(true); try { @@ -110,8 +100,8 @@ try { $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'user@example.com'; //SMTP username $mail->Password = 'secret'; //SMTP password - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption - $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` + $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged + $mail->Port = 587; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above //Recipients $mail->setFrom('from@example.com', 'Mailer'); @@ -138,21 +128,21 @@ try { } ``` -You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through Gmail, building contact forms, sending to mailing lists, and more. +You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through gmail, building contact forms, sending to mailing lists, and more. If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance. That's it. You should now be ready to use PHPMailer! ## Localization -PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder, you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: +PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: ```php //To load the French version $mail->setLanguage('fr', '/optional/path/to/language/directory/'); ``` -We welcome corrections and new languages – if you're looking for corrections, run the [Language/TranslationCompletenessTest.php](https://github.com/PHPMailer/PHPMailer/blob/master/test/Language/TranslationCompletenessTest.php) script in the tests folder and it will show any missing translations. +We welcome corrections and new languages – if you're looking for corrections, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations. ## Documentation Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, head for [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) as it's frequently updated. @@ -163,9 +153,9 @@ To reduce PHPMailer's deployed code footprint, examples are not included if you Complete generated API documentation is [available online](https://phpmailer.github.io/PHPMailer/). -You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](https://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailer/PHPMailerTest.php) a good reference for how to do various operations such as encryption. +You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](http://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailerTest.php) a good reference for how to do various operations such as encryption. -If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](https://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). +If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). ## Tests [PHPMailer tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/) use PHPUnit 9, with [a polyfill](https://github.com/Yoast/PHPUnit-Polyfills) to let 9-style tests run on older PHPUnit and PHP versions. @@ -180,9 +170,9 @@ Please disclose any vulnerabilities found responsibly – report security issues See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) and [PHPMailer's security advisories on GitHub](https://github.com/PHPMailer/PHPMailer/security). ## Contributing -Please submit bug reports, suggestions, and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). +Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). -We're particularly interested in fixing edge cases, expanding test coverage, and updating translations. +We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. If you found a mistake in the docs, or want to add something, go ahead and amend the wiki – anyone can edit it. @@ -206,7 +196,7 @@ Donations are very welcome, whether in beer 🍺, T-shirts 👕, or cold, hard c Available as part of the Tidelift Subscription. The maintainers of PHPMailer and thousands of other packages are working with Tidelift to deliver commercial -support and maintenance for the open-source packages you use to build your applications. Save time, reduce risk, and +support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-phpmailer?utm_source=packagist-phpmailer-phpmailer&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) @@ -214,7 +204,7 @@ use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-php See [changelog](changelog.md). ## History -- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](https://sourceforge.net/projects/phpmailer/). +- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). - [Marcus Bointon](https://github.com/Synchro) (`coolbru` on SF) and Andy Prevost (`codeworxtech`) took over the project in 2004. - Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski. - Marcus created [his fork on GitHub](https://github.com/Synchro/PHPMailer) in 2008. @@ -224,9 +214,9 @@ See [changelog](changelog.md). ### What's changed since moving from SourceForge? - Official successor to the SourceForge and Google Code projects. - Test suite. -- Continuous integration with GitHub Actions. +- Continuous integration with Github Actions. - Composer support. - Public development. - Additional languages and language strings. - CRAM-MD5 authentication support. -- Preserves full repo history of authors, commits, and branches from the original SourceForge project. +- Preserves full repo history of authors, commits and branches from the original SourceForge project. diff --git a/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md b/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md index 4f34026d..035a87f7 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md +++ b/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md @@ -13,13 +13,13 @@ PHPMailer versions 6.1.5 and earlier contain an output escaping bug that occurs PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing `phar://` paths into `addAttachment()` and other functions that may receive unfiltered local paths, possibly leading to RCE. Recorded as [CVE-2018-19296](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-19296). See [this article](https://knasmueller.net/5-answers-about-php-phar-exploitation) for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as `phar://`. Reported by Sehun Oh of cyberone.kr. -PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it is not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project. +PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it it not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project. PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity. PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer). -PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html). +PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](http://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html). PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending. diff --git a/phpmailer/vendor/phpmailer/phpmailer/SMTPUTF8.md b/phpmailer/vendor/phpmailer/phpmailer/SMTPUTF8.md deleted file mode 100644 index ca284ee2..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/SMTPUTF8.md +++ /dev/null @@ -1,48 +0,0 @@ -# A short history of UTF-8 in email - -## Background - -For most of its existence, SMTP has been a 7-bit channel, only supporting US-ASCII characters. This has been a problem for many languages, especially those that use non-Latin scripts, and has led to the development of various workarounds. - -The first major improvement, introduced in 1994 in [RFC 1652](https://www.rfc-editor.org/rfc/rfc1652) and extended in 2011 in [RFC 6152](https://www.rfc-editor.org/rfc/rfc6152), was the addition of the `8BITMIME` SMTP extension, which allowed raw 8-bit data to be included in message bodies sent over SMTP. -This allowed the message *contents* to contain 8-bit data, including things like UTF-8 text, even though the SMTP protocol itself was still firmly 7-bit. This worked by having the server switch to 8-bit after the headers, and then back to 7-bit after the completion of a `DATA` command. - -From 1996, messages could support [RFC 2047 encoding](https://www.rfc-editor.org/rfc/rfc2047), which permitted inserting characters from any character set into header *values* (but not names), but only by encoding them in somewhat unreadable ways to allow them to survive passage through a 7-bit channel. An example with a subject of "Schrödinger's cat" would be: - -``` -Subject: =?utf-8?Q=Schr=C3=B6dinger=92s_Cat?= -``` - -Here the accented `ö` is encoded as `=C3=B6`, which is the UTF-8 encoding of the 2-byte character, and the whole thing is wrapped in `=?utf-8?Q?` to indicate that it uses the UTF-8 charset and `quoted-printable` encoding. This is a bit of a hack, and not very human-friendly, but it works. - -Similarly, 8-bit message bodies could be encoded using the same `quoted-printable` and `base64` content transfer encoding (CTE) schemes, which preserved the 8-bit content while encoding it in a format that could survive transmission through a 7-bit channel. - -Domain names were originally also stuck in a 7-bit world, actually even more constrained to only a subset of the US-ASCII character set. But of course, many people want to have domains in their own language/script. Internationalized domain name (IDN) permitted this, using yet another complex encoding scheme called punycode, defined for domain names in 2003 in [RFC 3492](https://www.rfc-editor.org/rfc/rfc3492). This finally allowed the domain part (after the `@`) of email addresses to contain UTF-8, though it was actually an illusion preserved by email client applications. For example, an address of -`user@café.example.com` translates to -`user@xn--caf-dma.example.com` in punycode, rendering it mostly unreadable, but 7-bit friendly, and remaining compatible with email clients that don't know about IDN. - -The one remaining part of email that could not handle UTF-8 is the local part of email addresses (the part before the `@`). - -I've only mentioned UTF-8 here, but most of these approaches also allowed other character sets that were popular, such as [the ISO-8859 family](https://en.wikipedia.org/wiki/ISO/IEC_8859). However, UTF-8 solves so many problems that these other character sets are gradually falling out of favour, as UTF-8 can support all languages. - -This patchwork of overlapping approaches has served us well, but we have to admit that it's a mess. - -## SMTPUTF8 - -`SMTPUTF8` is another SMTP extension, defined in [RFC 6531](https://www.rfc-editor.org/rfc/rfc6531) in 2012. This essentially solves the whole problem, allowing the entire SMTP conversation — commands, headers, and message bodies — to be sent in raw, unencoded UTF-8. - -But there's a problem with this approach: adoption. If you send a UTF-8 message to a recipient whose mail server doesn't support this format, the sender has to somehow downgrade the message to make it survive a transition to 7-bit. This is a hard problem to solve, especially since there is no way to make a 7-bit system support UTF-8 in the local parts of addresses. This downgrade problem is what held up the adoption of `SMTPUTF8` in PHPMailer for many years, but in that time the *de facto* approach has become to simply fail in that situation, and tell the recipient it's time they upgraded their mail server 😅. - -The vast majority of large email providers (gmail, Yahoo, Microsoft, etc), mail servers (postfix, exim, IIS, etc), and mail clients (Apple Mail, Outlook, Thunderbird, etc) now all support SMTPUTF8, so the need for backward compatibility is no longer what it was. - -## SMTPUTF8 in PHPMailer - -Several other PHP email libraries have implemented a halfway solution to `SMTPUTF8`, adding only the ability to support UTF-8 in email addresses, not elsewhere in the protocol. I wanted PHPMailer to do it "the right way", and this has taken much longer. PHPMailer now supports UTF-8 everywhere, and does not need to use transfer or header encodings for UTF-8 text when connecting to an `SMTPUTF8`-capable mail server. - -This support is handled automatically: if you add an email address that requires UTF-8, PHPMailer will use UTF-8 for everything. If not, it will fall back to 7-bit and encode the message as necessary. - -The one place you will need to be careful is in the selection of the address validator. By default, PHPMailer uses PHP's built-in `filter_var` validator, which does not allow UTF-8 email addresses. When PHPMailer spots that you have submitted a UTF-8 address, but have not altered the default validator, it will automatically switch to using a UTF-8-compatible validator. As soon as you do this, any SMTP connection you make will *require* that the server you connect to supports `SMTPUTF8`. You can select this validator explicitly by setting `PHPMailer::$validator = 'eai'` (an acronym for Email Address Internationalization). - -### Postfix gotcha - -Postfix has supported `SMTPUTF8` for a long time, but it has a peculiarity that it does not always advertise that it does so. However, rather surprisingly, if you use UTF-8 in the conversation, it will work anyway. diff --git a/phpmailer/vendor/phpmailer/phpmailer/VERSION b/phpmailer/vendor/phpmailer/phpmailer/VERSION index cf79bf90..4be2c727 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/VERSION +++ b/phpmailer/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -6.10.0 +6.5.0 \ No newline at end of file diff --git a/phpmailer/vendor/phpmailer/phpmailer/composer.json b/phpmailer/vendor/phpmailer/phpmailer/composer.json index 7b008b7c..58393b2c 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/composer.json +++ b/phpmailer/vendor/phpmailer/phpmailer/composer.json @@ -25,12 +25,6 @@ "type": "github" } ], - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - }, - "lock": false - }, "require": { "php": ">=5.5.0", "ext-ctype": "*", @@ -38,24 +32,19 @@ "ext-hash": "*" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/annotations": "^1.2.6 || ^1.13.3", - "php-parallel-lint/php-console-highlighter": "^1.0.0", - "php-parallel-lint/php-parallel-lint": "^1.3.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "doctrine/annotations": "^1.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.2", - "yoast/phpunit-polyfills": "^1.0.4" + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { - "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", - "ext-openssl": "Needed for secure SMTP sending and DKIM signing", - "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", - "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication", + "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" }, "autoload": { @@ -71,10 +60,6 @@ "license": "LGPL-2.1-only", "scripts": { "check": "./vendor/bin/phpcs", - "test": "./vendor/bin/phpunit --no-coverage", - "coverage": "./vendor/bin/phpunit", - "lint": [ - "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build" - ] + "test": "./vendor/bin/phpunit" } } diff --git a/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php b/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php index 0e54a00b..befdc34a 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php +++ b/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php @@ -12,7 +12,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -36,7 +36,7 @@ namespace PHPMailer\PHPMailer; * Aliases for League Provider Classes * Make sure you have added these to your composer.json and run `composer install` * Plenty to choose from here: - * @see https://oauth2-client.thephpleague.com/providers/thirdparty/ + * @see http://oauth2-client.thephpleague.com/providers/thirdparty/ */ //@see https://github.com/thephpleague/oauth2-google use League\OAuth2\Client\Provider\Google; @@ -44,31 +44,14 @@ use League\OAuth2\Client\Provider\Google; use Hayageek\OAuth2\Client\Provider\Yahoo; //@see https://github.com/stevenmaguire/oauth2-microsoft use Stevenmaguire\OAuth2\Client\Provider\Microsoft; -//@see https://github.com/greew/oauth2-azure-provider -use Greew\OAuth2\Client\Provider\Azure; -if (!isset($_GET['code']) && !isset($_POST['provider'])) { +if (!isset($_GET['code']) && !isset($_GET['provider'])) { ?> - -
-

Select Provider

- -
- -
- -
- -
-

Enter id and secret

-

These details are obtained by setting up an app in your provider's developer console. -

-

ClientId:

-

ClientSecret:

-

TenantID (only relevant for Azure):

- -
+Select Provider:
+
Google
+Yahoo
+Microsoft/Outlook/Hotmail/Live/Office365
[ - 'https://outlook.office.com/SMTP.Send', - 'offline_access' - ] - ]; - break; } if (null === $provider) { @@ -178,5 +142,5 @@ if (!isset($_GET['code'])) { ); //Use this to interact with an API on the users behalf //Use this to get a new access token if the old one expires - echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken()); + echo 'Refresh Token: ', $token->getRefreshToken(); } diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php deleted file mode 100644 index 327dfbaf..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP ত্ৰুটি: প্ৰমাণীকৰণ কৰিব নোৱাৰি'; -$PHPMAILER_LANG['buggy_php'] = 'আপোনাৰ PHP সংস্কৰণ এটা বাগৰ দ্বাৰা প্ৰভাৱিত হয় যাৰ ফলত নষ্ট বাৰ্তা হব পাৰে । ইয়াক সমাধান কৰিবলে, প্ৰেৰণ কৰিবলে SMTP ব্যৱহাৰ কৰক, আপোনাৰ php.ini ত mail.add_x_header বিকল্প নিষ্ক্ৰিয় কৰক, MacOS বা Linux লৈ সলনি কৰক, বা আপোনাৰ PHP সংস্কৰণ 7.0.17+ বা 7.1.3+ লৈ সলনি কৰক ।'; -$PHPMAILER_LANG['connect_host'] = 'SMTP ত্ৰুটি: SMTP চাৰ্ভাৰৰ সৈতে সংযোগ কৰিবলে অক্ষম'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP ত্ৰুটি: তথ্য গ্ৰহণ কৰা হোৱা নাই'; -$PHPMAILER_LANG['empty_message'] = 'বাৰ্তাৰ মূখ্য অংশ খালী।'; -$PHPMAILER_LANG['encoding'] = 'অজ্ঞাত এনকোডিং: '; -$PHPMAILER_LANG['execute'] = 'এক্সিকিউট কৰিব নোৱাৰি: '; -$PHPMAILER_LANG['extension_missing'] = 'সম্প্ৰসাৰণ নোহোৱা হৈছে: '; -$PHPMAILER_LANG['file_access'] = 'ফাইল অভিগম কৰিবলে অক্ষম: '; -$PHPMAILER_LANG['file_open'] = 'ফাইল ত্ৰুটি: ফাইল খোলিবলৈ অক্ষম: '; -$PHPMAILER_LANG['from_failed'] = 'নিম্নলিখিত প্ৰেৰকৰ ঠিকনা(সমূহ) ব্যৰ্থ: '; -$PHPMAILER_LANG['instantiate'] = 'মেইল ফাংচনৰ এটা উদাহৰণ সৃষ্টি কৰিবলে অক্ষম'; -$PHPMAILER_LANG['invalid_address'] = 'প্ৰেৰণ কৰিব নোৱাৰি: অবৈধ ইমেইল ঠিকনা: '; -$PHPMAILER_LANG['invalid_header'] = 'অবৈধ হেডাৰৰ নাম বা মান'; -$PHPMAILER_LANG['invalid_hostentry'] = 'অবৈধ হোষ্টেন্ট্ৰি: '; -$PHPMAILER_LANG['invalid_host'] = 'অবৈধ হস্ট:'; -$PHPMAILER_LANG['mailer_not_supported'] = 'মেইলাৰ সমৰ্থিত নহয়।'; -$PHPMAILER_LANG['provide_address'] = 'আপুনি অন্ততঃ এটা গন্তব্য ইমেইল ঠিকনা দিব লাগিব'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP ত্ৰুটি: নিম্নলিখিত গন্তব্যস্থানসমূহ ব্যৰ্থ: '; -$PHPMAILER_LANG['signing'] = 'স্বাক্ষৰ কৰাত ব্যৰ্থ: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP কড: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'অতিৰিক্ত SMTP তথ্য: '; -$PHPMAILER_LANG['smtp_detail'] = 'বিৱৰণ:'; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP সংযোগ() ব্যৰ্থ'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP চাৰ্ভাৰৰ ত্ৰুটি: '; -$PHPMAILER_LANG['variable_set'] = 'চলক নিৰ্ধাৰণ কৰিব পৰা নগল: '; -$PHPMAILER_LANG['extension_missing'] = 'অনুপস্থিত সম্প্ৰসাৰণ: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php deleted file mode 100644 index 47365108..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP ত্রুটি: প্রমাণীকরণ করতে অক্ষম৷'; -$PHPMAILER_LANG['buggy_php'] = 'আপনার PHP সংস্করণ একটি বাগ দ্বারা প্রভাবিত হয় যার ফলে দূষিত বার্তা হতে পারে। এটি ঠিক করতে, পাঠাতে SMTP ব্যবহার করুন, আপনার php.ini এ mail.add_x_header বিকল্পটি নিষ্ক্রিয় করুন, MacOS বা Linux-এ স্যুইচ করুন, অথবা আপনার PHP সংস্করণকে 7.0.17+ বা 7.1.3+ এ পরিবর্তন করুন।'; -$PHPMAILER_LANG['connect_host'] = 'SMTP ত্রুটি: SMTP সার্ভারের সাথে সংযোগ করতে অক্ষম৷'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP ত্রুটি: ডেটা গ্রহণ করা হয়নি৷'; -$PHPMAILER_LANG['empty_message'] = 'বার্তার অংশটি খালি।'; -$PHPMAILER_LANG['encoding'] = 'অজানা এনকোডিং: '; -$PHPMAILER_LANG['execute'] = 'নির্বাহ করতে অক্ষম: '; -$PHPMAILER_LANG['extension_missing'] = 'এক্সটেনশন অনুপস্থিত:'; -$PHPMAILER_LANG['file_access'] = 'ফাইল অ্যাক্সেস করতে অক্ষম: '; -$PHPMAILER_LANG['file_open'] = 'ফাইল ত্রুটি: ফাইল খুলতে অক্ষম: '; -$PHPMAILER_LANG['from_failed'] = 'নিম্নলিখিত প্রেরকের ঠিকানা(গুলি) ব্যর্থ হয়েছে: '; -$PHPMAILER_LANG['instantiate'] = 'মেল ফাংশনের একটি উদাহরণ তৈরি করতে অক্ষম৷'; -$PHPMAILER_LANG['invalid_address'] = 'পাঠাতে অক্ষম: অবৈধ ইমেল ঠিকানা: '; -$PHPMAILER_LANG['invalid_header'] = 'অবৈধ হেডার নাম বা মান'; -$PHPMAILER_LANG['invalid_hostentry'] = 'অবৈধ হোস্টেন্ট্রি: '; -$PHPMAILER_LANG['invalid_host'] = 'অবৈধ হোস্ট:'; -$PHPMAILER_LANG['mailer_not_supported'] = 'মেইলার সমর্থিত নয়।'; -$PHPMAILER_LANG['provide_address'] = 'আপনাকে অবশ্যই অন্তত একটি গন্তব্য ইমেল ঠিকানা প্রদান করতে হবে৷'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP ত্রুটি: নিম্নলিখিত গন্তব্যগুলি ব্যর্থ হয়েছে: '; -$PHPMAILER_LANG['signing'] = 'স্বাক্ষর করতে ব্যর্থ হয়েছে: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP কোড: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'অতিরিক্ত SMTP তথ্য:'; -$PHPMAILER_LANG['smtp_detail'] = 'বর্ণনা: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP সংযোগ() ব্যর্থ হয়েছে৷'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP সার্ভার ত্রুটি: '; -$PHPMAILER_LANG['variable_set'] = 'পরিবর্তনশীল সেট করা যায়নি: '; -$PHPMAILER_LANG['extension_missing'] = 'অনুপস্থিত এক্সটেনশন: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php new file mode 100644 index 00000000..500c9526 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php @@ -0,0 +1,27 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验证失败。'; +$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: 不能连接SMTP主机。'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: 数据不可接受。'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['encoding'] = '未知编码:'; +$PHPMAILER_LANG['execute'] = '不能执行: '; +$PHPMAILER_LANG['file_access'] = '不能访问文件:'; +$PHPMAILER_LANG['file_open'] = '文件错误:不能打开文件:'; +$PHPMAILER_LANG['from_failed'] = '下面的发送地址邮件发送失败了: '; +$PHPMAILER_LANG['instantiate'] = '不能实现mail方法。'; +//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的发送邮件的方法并不支持。'; +$PHPMAILER_LANG['provide_address'] = '您必须提供至少一个 收信人的email地址。'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下面的 收件人失败了: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php index db9a1ef5..1edba1d7 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php @@ -9,28 +9,21 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Login mislykkedes.'; -$PHPMAILER_LANG['buggy_php'] = 'Din version af PHP er berørt af en fejl, som gør at dine beskeder muligvis vises forkert. For at rette dette kan du skifte til SMTP, slå mail.add_x_header headeren i din php.ini fil fra, skifte til MacOS eller Linux eller opgradere din version af PHP til 7.0.17+ eller 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Forbindelse til SMTP serveren kunne ikke oprettes.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data blev ikke accepteret.'; $PHPMAILER_LANG['empty_message'] = 'Meddelelsen er uden indhold'; $PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; $PHPMAILER_LANG['execute'] = 'Kunne ikke afvikle: '; -$PHPMAILER_LANG['extension_missing'] = 'Udvidelse mangler: '; $PHPMAILER_LANG['file_access'] = 'Kunne ikke tilgå filen: '; $PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: '; $PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; $PHPMAILER_LANG['instantiate'] = 'Email funktionen kunne ikke initialiseres.'; $PHPMAILER_LANG['invalid_address'] = 'Udgyldig adresse: '; -$PHPMAILER_LANG['invalid_header'] = 'Ugyldig header navn eller værdi'; -$PHPMAILER_LANG['invalid_hostentry'] = 'Ugyldig hostentry: '; -$PHPMAILER_LANG['invalid_host'] = 'Ugyldig vært: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; $PHPMAILER_LANG['provide_address'] = 'Indtast mindst en modtagers email adresse.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere fejlede: '; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; $PHPMAILER_LANG['signing'] = 'Signeringsfejl: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP kode: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Yderligere SMTP info: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fejlede.'; -$PHPMAILER_LANG['smtp_detail'] = 'Detalje: '; $PHPMAILER_LANG['smtp_error'] = 'SMTP server fejl: '; $PHPMAILER_LANG['variable_set'] = 'Kunne ikke definere eller nulstille variablen: '; +$PHPMAILER_LANG['extension_missing'] = 'Udvidelse mangler: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php index 339ee575..b3d5ca94 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php @@ -5,29 +5,22 @@ * @package PHPMailer */ -$PHPMAILER_LANG['authenticate'] = 'Σφάλμα SMTP: Αδυναμία πιστοποίησης.'; -$PHPMAILER_LANG['buggy_php'] = 'Η έκδοση PHP που χρησιμοποιείτε παρουσιάζει σφάλμα που μπορεί να έχει ως αποτέλεσμα κατεστραμένα μηνύματα. Για να το διορθώσετε, αλλάξτε τον τρόπο αποστολής σε SMTP, απενεργοποιήστε την επιλογή mail.add_x_header στο αρχείο php.ini, αλλάξτε λειτουργικό σε MacOS ή Linux ή αναβαθμίστε την PHP σε έκδοση 7.0.17+ ή 7.1.3+.'; -$PHPMAILER_LANG['connect_host'] = 'Σφάλμα SMTP: Αδυναμία σύνδεσης με τον φιλοξενητή SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Σφάλμα SMTP: Μη αποδεκτά δεδομένα.'; -$PHPMAILER_LANG['empty_message'] = 'Η ηλεκτρονική επιστολή δεν έχει περιεχόμενο.'; -$PHPMAILER_LANG['encoding'] = 'Άγνωστη μορφή κωδικοποίησης: '; -$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης: '; -$PHPMAILER_LANG['extension_missing'] = 'Απουσία επέκτασης: '; -$PHPMAILER_LANG['file_access'] = 'Αδυναμία πρόσβασης στο αρχείο: '; -$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Αδυναμία ανοίγματος αρχείου: '; -$PHPMAILER_LANG['from_failed'] = 'Η ακόλουθη διεύθυνση αποστολέα δεν είναι σωστή: '; -$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης συνάρτησης Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Μη έγκυρη διεύθυνση: '; -$PHPMAILER_LANG['invalid_header'] = 'Μη έγκυρο όνομα κεφαλίδας ή τιμή'; -$PHPMAILER_LANG['invalid_hostentry'] = 'Μη έγκυρη εισαγωγή φιλοξενητή: '; -$PHPMAILER_LANG['invalid_host'] = 'Μη έγκυρος φιλοξενητής: '; +$PHPMAILER_LANG['authenticate'] = 'SMTP Σφάλμα: Αδυναμία πιστοποίησης (authentication).'; +$PHPMAILER_LANG['connect_host'] = 'SMTP Σφάλμα: Αδυναμία σύνδεσης στον SMTP-Host.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Σφάλμα: Τα δεδομένα δεν έγιναν αποδεκτά.'; +$PHPMAILER_LANG['empty_message'] = 'Το E-Mail δεν έχει περιεχόμενο .'; +$PHPMAILER_LANG['encoding'] = 'Αγνωστο Encoding-Format: '; +$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης ακόλουθης εντολής: '; +$PHPMAILER_LANG['file_access'] = 'Αδυναμία προσπέλασης του αρχείου: '; +$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Δεν είναι δυνατό το άνοιγμα του ακόλουθου αρχείου: '; +$PHPMAILER_LANG['from_failed'] = 'Η παρακάτω διεύθυνση αποστολέα δεν είναι σωστή: '; +$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης Mail function.'; +$PHPMAILER_LANG['invalid_address'] = 'Το μήνυμα δεν εστάλη, η διεύθυνση δεν είναι έγκυρη: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer δεν υποστηρίζεται.'; -$PHPMAILER_LANG['provide_address'] = 'Δώστε τουλάχιστον μια ηλεκτρονική διεύθυνση παραλήπτη.'; -$PHPMAILER_LANG['recipients_failed'] = 'Σφάλμα SMTP: Οι παρακάτω διευθύνσεις παραλήπτη δεν είναι έγκυρες: '; +$PHPMAILER_LANG['provide_address'] = 'Παρακαλούμε δώστε τουλάχιστον μια e-mail διεύθυνση παραλήπτη.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Σφάλμα: Οι παρακάτω διευθύνσεις παραλήπτη δεν είναι έγκυρες: '; $PHPMAILER_LANG['signing'] = 'Σφάλμα υπογραφής: '; -$PHPMAILER_LANG['smtp_code'] = 'Κώδικάς SMTP: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Πρόσθετες πληροφορίες SMTP: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης SMTP.'; -$PHPMAILER_LANG['smtp_detail'] = 'Λεπτομέρεια: '; -$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα με τον διακομιστή SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή επαναφοράς μεταβλητής: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης στον SMTP Server.'; +$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα από τον SMTP Server: '; +$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή αρχικοποίησης μεταβλητής: '; +//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php index 4e74bfb7..6ba74627 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php @@ -4,33 +4,24 @@ * Spanish PHPMailer language file: refer to English translation for definitive list * @package PHPMailer * @author Matt Sturdy - * @author Crystopher Glodzienski Cardoso - * @author Daniel Cruz */ $PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.'; -$PHPMAILER_LANG['buggy_php'] = 'Tu versión de PHP está afectada por un bug que puede resultar en mensajes corruptos. Para arreglarlo, cambia a enviar usando SMTP, deshabilita la opción mail.add_x_header en tu php.ini, cambia a MacOS o Linux, o actualiza tu PHP a la versión 7.0.17+ o 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.'; $PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.'; $PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío.'; $PHPMAILER_LANG['encoding'] = 'Codificación desconocida: '; $PHPMAILER_LANG['execute'] = 'Imposible ejecutar: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: '; $PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: '; $PHPMAILER_LANG['file_open'] = 'Error de Archivo: Imposible abrir el archivo: '; $PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: '; $PHPMAILER_LANG['instantiate'] = 'Imposible crear una instancia de la función Mail.'; $PHPMAILER_LANG['invalid_address'] = 'Imposible enviar: dirección de email inválido: '; -$PHPMAILER_LANG['invalid_header'] = 'Nombre o valor de encabezado no válido'; -$PHPMAILER_LANG['invalid_hostentry'] = 'Hostentry inválido: '; -$PHPMAILER_LANG['invalid_host'] = 'Host inválido: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.'; $PHPMAILER_LANG['provide_address'] = 'Debe proporcionar al menos una dirección de email de destino.'; $PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinos fallaron: '; $PHPMAILER_LANG['signing'] = 'Error al firmar: '; -$PHPMAILER_LANG['smtp_code'] = 'Código del servidor SMTP: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Información adicional del servidor SMTP: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.'; -$PHPMAILER_LANG['smtp_detail'] = 'Detalle: '; $PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; +$PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php index 6d1e6373..243c0548 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php @@ -20,6 +20,7 @@ $PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.'; $PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.'; $PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähköpostiosoite.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.'; +$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; //$PHPMAILER_LANG['signing'] = 'Signing Error: '; //$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; //$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php index a6d582d8..b57f0ec6 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php @@ -6,31 +6,27 @@ * Some French punctuation requires a thin non-breaking space (U+202F) character before it, * for example before a colon or exclamation mark. * There is one of these characters between these quotes: " " + * @see http://unicode.org/udhr/n/notes_fra.html */ -$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l’authentification.'; -$PHPMAILER_LANG['buggy_php'] = 'Votre version de PHP est affectée par un bug qui peut entraîner des messages corrompus. Pour résoudre ce problème, passez à l’envoi par SMTP, désactivez l’option mail.add_x_header dans le fichier php.ini, passez à MacOS ou Linux, ou passez PHP à la version 7.0.17+ ou 7.1.3+.'; +$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l\'authentification.'; $PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : impossible de se connecter au serveur SMTP.'; $PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : données incorrectes.'; $PHPMAILER_LANG['empty_message'] = 'Corps du message vide.'; $PHPMAILER_LANG['encoding'] = 'Encodage inconnu : '; -$PHPMAILER_LANG['execute'] = 'Impossible de lancer l’exécution : '; -$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : '; -$PHPMAILER_LANG['file_access'] = 'Impossible d’accéder au fichier : '; +$PHPMAILER_LANG['execute'] = 'Impossible de lancer l\'exécution : '; +$PHPMAILER_LANG['file_access'] = 'Impossible d\'accéder au fichier : '; $PHPMAILER_LANG['file_open'] = 'Ouverture du fichier impossible : '; -$PHPMAILER_LANG['from_failed'] = 'L’adresse d’expéditeur suivante a échoué : '; -$PHPMAILER_LANG['instantiate'] = 'Impossible d’instancier la fonction mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Adresse courriel non valide : '; -$PHPMAILER_LANG['invalid_header'] = 'Nom ou valeur de l’en-tête non valide'; -$PHPMAILER_LANG['invalid_hostentry'] = 'Entrée d’hôte non valide : '; -$PHPMAILER_LANG['invalid_host'] = 'Hôte non valide : '; +$PHPMAILER_LANG['from_failed'] = 'L\'adresse d\'expéditeur suivante a échoué : '; +$PHPMAILER_LANG['instantiate'] = 'Impossible d\'instancier la fonction mail.'; +$PHPMAILER_LANG['invalid_address'] = 'L\'adresse courriel n\'est pas valide : '; +$PHPMAILER_LANG['invalid_hostentry'] = 'L\'entrée hôte n\'est pas valide : '; +$PHPMAILER_LANG['invalid_host'] = 'L\'hôte n\'est pas valide : '; $PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.'; $PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants ont échoué : '; +$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants sont en erreur : '; $PHPMAILER_LANG['signing'] = 'Erreur de signature : '; -$PHPMAILER_LANG['smtp_code'] = 'Code SMTP : '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Informations supplémentaires SMTP : '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'La fonction SMTP connect() a échoué.'; -$PHPMAILER_LANG['smtp_detail'] = 'Détails : '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Échec de la connexion SMTP.'; $PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : '; -$PHPMAILER_LANG['variable_set'] = 'Impossible d’initialiser ou de réinitialiser une variable : '; +$PHPMAILER_LANG['variable_set'] = 'Impossible d\'initialiser ou de réinitialiser une variable : '; +$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php index d2856e05..d973a359 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php @@ -4,32 +4,24 @@ * Hindi PHPMailer language file: refer to English translation for definitive list * @package PHPMailer * @author Yash Karanke - * Rewrite and extension of the work by Jayanti Suthar */ $PHPMAILER_LANG['authenticate'] = 'SMTP त्रुटि: प्रामाणिकता की जांच नहीं हो सका। '; -$PHPMAILER_LANG['buggy_php'] = 'PHP का आपका संस्करण एक बग से प्रभावित है जिसके परिणामस्वरूप संदेश दूषित हो सकते हैं. इसे ठीक करने हेतु, भेजने के लिए SMTP का उपयोग करे, अपने php.ini में mail.add_x_header विकल्प को अक्षम करें, MacOS या Linux पर जाए, या अपने PHP संस्करण को 7.0.17+ या 7.1.3+ बदले.'; $PHPMAILER_LANG['connect_host'] = 'SMTP त्रुटि: SMTP सर्वर से कनेक्ट नहीं हो सका। '; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP त्रुटि: डेटा स्वीकार नहीं किया जाता है। '; $PHPMAILER_LANG['empty_message'] = 'संदेश खाली है। '; $PHPMAILER_LANG['encoding'] = 'अज्ञात एन्कोडिंग प्रकार। '; $PHPMAILER_LANG['execute'] = 'आदेश को निष्पादित करने में विफल। '; -$PHPMAILER_LANG['extension_missing'] = 'एक्सटेन्षन गायब है: '; $PHPMAILER_LANG['file_access'] = 'फ़ाइल उपलब्ध नहीं है। '; $PHPMAILER_LANG['file_open'] = 'फ़ाइल त्रुटि: फाइल को खोला नहीं जा सका। '; $PHPMAILER_LANG['from_failed'] = 'प्रेषक का पता गलत है। '; $PHPMAILER_LANG['instantiate'] = 'मेल फ़ंक्शन कॉल नहीं कर सकता है।'; $PHPMAILER_LANG['invalid_address'] = 'पता गलत है। '; -$PHPMAILER_LANG['invalid_header'] = 'अमान्य हेडर नाम या मान'; -$PHPMAILER_LANG['invalid_hostentry'] = 'अमान्य hostentry: '; -$PHPMAILER_LANG['invalid_host'] = 'अमान्य होस्ट: '; $PHPMAILER_LANG['mailer_not_supported'] = 'मेल सर्वर के साथ काम नहीं करता है। '; $PHPMAILER_LANG['provide_address'] = 'आपको कम से कम एक प्राप्तकर्ता का ई-मेल पता प्रदान करना होगा।'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP त्रुटि: निम्न प्राप्तकर्ताओं को पते भेजने में विफल। '; -$PHPMAILER_LANG['signing'] = 'साइनअप त्रुटि: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP कोड: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'अतिरिक्त SMTP जानकारी: '; +$PHPMAILER_LANG['signing'] = 'साइनअप त्रुटि:। '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP का connect () फ़ंक्शन विफल हुआ। '; -$PHPMAILER_LANG['smtp_detail'] = 'विवरण: '; $PHPMAILER_LANG['smtp_error'] = 'SMTP सर्वर त्रुटि। '; $PHPMAILER_LANG['variable_set'] = 'चर को बना या संशोधित नहीं किया जा सकता। '; +$PHPMAILER_LANG['extension_missing'] = 'एक्सटेन्षन गायब है: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php index d01869ce..eee79898 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php @@ -3,35 +3,26 @@ /** * Japanese PHPMailer language file: refer to English translation for definitive list * @package PHPMailer - * @author Mitsuhiro Yoshida + * @author Mitsuhiro Yoshida * @author Yoshi Sakai - * @author Arisophy - * @author ARAKI Musashi */ $PHPMAILER_LANG['authenticate'] = 'SMTPエラー: 認証できませんでした。'; -$PHPMAILER_LANG['buggy_php'] = 'ご利用のバージョンのPHPには不具合があり、メッセージが破損するおそれがあります。問題の解決は以下のいずれかを行ってください。SMTPでの送信に切り替える。php.iniのmail.add_x_headerをoffにする。MacOSまたはLinuxに切り替える。PHPバージョン7.0.17以降または7.1.3以降にアップグレードする。'; $PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPホストに接続できませんでした。'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データが受け付けられませんでした。'; -$PHPMAILER_LANG['empty_message'] = 'メール本文が空です。'; +//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; $PHPMAILER_LANG['encoding'] = '不明なエンコーディング: '; $PHPMAILER_LANG['execute'] = '実行できませんでした: '; -$PHPMAILER_LANG['extension_missing'] = '拡張機能が見つかりません: '; $PHPMAILER_LANG['file_access'] = 'ファイルにアクセスできません: '; $PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開けません: '; $PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録する際にエラーが発生しました: '; $PHPMAILER_LANG['instantiate'] = 'メール関数が正常に動作しませんでした。'; -$PHPMAILER_LANG['invalid_address'] = '不正なメールアドレス: '; -$PHPMAILER_LANG['invalid_header'] = '不正なヘッダー名またはその内容'; -$PHPMAILER_LANG['invalid_hostentry'] = '不正なホストエントリー: '; -$PHPMAILER_LANG['invalid_host'] = '不正なホスト: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。'; +//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; $PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。'; +$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。'; $PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次の受信者アドレスに 間違いがあります: '; -$PHPMAILER_LANG['signing'] = '署名エラー: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTPコード: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'SMTP追加情報: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP接続に失敗しました。'; -$PHPMAILER_LANG['smtp_detail'] = '詳細: '; -$PHPMAILER_LANG['smtp_error'] = 'SMTPサーバーエラー: '; -$PHPMAILER_LANG['variable_set'] = '変数が存在しません: '; +//$PHPMAILER_LANG['signing'] = 'Signing Error: '; +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; +//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php deleted file mode 100644 index cf3bda69..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'هەڵەی SMTP : نەتوانرا کۆدەکە پشتڕاست بکرێتەوە '; -$PHPMAILER_LANG['connect_host'] = 'هەڵەی SMTP: نەتوانرا پەیوەندی بە سێرڤەرەوە بکات SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'هەڵەی SMTP: ئەو زانیاریانە قبوڵ نەکرا.'; -$PHPMAILER_LANG['empty_message'] = 'پەیامەکە بەتاڵە'; -$PHPMAILER_LANG['encoding'] = 'کۆدکردنی نەزانراو : '; -$PHPMAILER_LANG['execute'] = 'ناتوانرێت جێبەجێ بکرێت: '; -$PHPMAILER_LANG['file_access'] = 'ناتوانرێت دەستت بگات بە فایلەکە: '; -$PHPMAILER_LANG['file_open'] = 'هەڵەی پەڕگە(فایل): ناتوانرێت بکرێتەوە: '; -$PHPMAILER_LANG['from_failed'] = 'هەڵە لە ئاستی ناونیشانی نێرەر: '; -$PHPMAILER_LANG['instantiate'] = 'ناتوانرێت خزمەتگوزاری پۆستە پێشکەش بکرێت.'; -$PHPMAILER_LANG['invalid_address'] = 'نەتوانرا بنێردرێت ، چونکە ناونیشانی ئیمەیڵەکە نادروستە: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' مەیلەر پشتگیری ناکات'; -$PHPMAILER_LANG['provide_address'] = 'دەبێت ناونیشانی ئیمەیڵی لانیکەم یەک وەرگر دابین بکرێت.'; -$PHPMAILER_LANG['recipients_failed'] = ' هەڵەی SMTP: ئەم هەڵانەی خوارەوەشکستی هێنا لە ناردن بۆ هەردووکیان: '; -$PHPMAILER_LANG['signing'] = 'هەڵەی واژۆ: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect()پەیوەندی شکستی هێنا .'; -$PHPMAILER_LANG['smtp_error'] = 'هەڵەی ئاستی سێرڤەری SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'ناتوانرێت بیگۆڕیت یان دوبارە بینێریتەوە: '; -$PHPMAILER_LANG['extension_missing'] = 'درێژکراوە نەماوە: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php deleted file mode 100644 index 04d262c7..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php +++ /dev/null @@ -1,27 +0,0 @@ - + * @author Jonadabe */ -$PHPMAILER_LANG['authenticate'] = 'Erro SMTP: Falha na autenticação.'; -$PHPMAILER_LANG['buggy_php'] = 'A sua versão do PHP tem um bug que pode causar mensagens corrompidas. Para resolver, utilize o envio por SMTP, desative a opção mail.add_x_header no ficheiro php.ini, mude para MacOS ou Linux, ou atualize o PHP para a versão 7.0.17+ ou 7.1.3+.'; -$PHPMAILER_LANG['connect_host'] = 'Erro SMTP: Não foi possível ligar ao servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro SMTP: Dados não aceites.'; -$PHPMAILER_LANG['empty_message'] = 'A mensagem de e-mail está vazia.'; +$PHPMAILER_LANG['authenticate'] = 'Erro do SMTP: Não foi possível realizar a autenticação.'; +$PHPMAILER_LANG['connect_host'] = 'Erro do SMTP: Não foi possível realizar ligação com o servidor SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'Erro do SMTP: Os dados foram rejeitados.'; +$PHPMAILER_LANG['empty_message'] = 'A mensagem no e-mail está vazia.'; $PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; $PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão em falta: '; -$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder ao ficheiro: '; -$PHPMAILER_LANG['file_open'] = 'Erro ao abrir o ficheiro: '; -$PHPMAILER_LANG['from_failed'] = 'O envio falhou para o seguinte endereço do remetente: '; -$PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: '; -$PHPMAILER_LANG['invalid_header'] = 'Nome ou valor do cabeçalho inválido.'; -$PHPMAILER_LANG['invalid_hostentry'] = 'Entrada de host inválida: '; -$PHPMAILER_LANG['invalid_host'] = 'Host inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = 'O cliente de e-mail não é suportado.'; -$PHPMAILER_LANG['provide_address'] = 'Deve fornecer pelo menos um endereço de destinatário.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro SMTP: Falha no envio para os seguintes destinatários: '; +$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder o ficheiro: '; +$PHPMAILER_LANG['file_open'] = 'Abertura do ficheiro: Não foi possível abrir o ficheiro: '; +$PHPMAILER_LANG['from_failed'] = 'Ocorreram falhas nos endereços dos seguintes remententes: '; +$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.'; +$PHPMAILER_LANG['invalid_address'] = 'Não foi enviado nenhum e-mail para o endereço de e-mail inválido: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; +$PHPMAILER_LANG['provide_address'] = 'Tem de fornecer pelo menos um endereço como destinatário do e-mail.'; +$PHPMAILER_LANG['recipients_failed'] = 'Erro do SMTP: O endereço do seguinte destinatário falhou: '; $PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; -$PHPMAILER_LANG['smtp_code'] = 'Código SMTP: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Informações adicionais SMTP: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Falha na função SMTP connect().'; -$PHPMAILER_LANG['smtp_detail'] = 'Detalhes: '; -$PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; +$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; +$PHPMAILER_LANG['extension_missing'] = 'Extensão em falta: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php index 5239865a..d8638098 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php @@ -7,32 +7,24 @@ * @author Lucas Guimarães * @author Phelipe Alves * @author Fabio Beneditto - * @author Geidson Benício Coelho */ $PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.'; -$PHPMAILER_LANG['buggy_php'] = 'Sua versão do PHP é afetada por um bug que por resultar em messagens corrompidas. Para corrigir, mude para enviar usando SMTP, desative a opção mail.add_x_header em seu php.ini, mude para MacOS ou Linux, ou atualize seu PHP para versão 7.0.17+ ou 7.1.3+ '; $PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar ao servidor SMTP.'; $PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.'; $PHPMAILER_LANG['empty_message'] = 'Mensagem vazia'; $PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; $PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão não existe: '; $PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: '; $PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: '; $PHPMAILER_LANG['from_failed'] = 'Os seguintes remetentes falharam: '; $PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; $PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: '; -$PHPMAILER_LANG['invalid_header'] = 'Nome ou valor de cabeçalho inválido'; -$PHPMAILER_LANG['invalid_hostentry'] = 'hostentry inválido: '; -$PHPMAILER_LANG['invalid_host'] = 'host inválido: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; $PHPMAILER_LANG['provide_address'] = 'Você deve informar pelo menos um destinatário.'; $PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os seguintes destinatários falharam: '; $PHPMAILER_LANG['signing'] = 'Erro de Assinatura: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; -$PHPMAILER_LANG['smtp_code'] = 'Código do servidor SMTP: '; $PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Informações adicionais do servidor SMTP: '; -$PHPMAILER_LANG['smtp_detail'] = 'Detalhes do servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; +$PHPMAILER_LANG['extension_missing'] = 'Extensão não existe: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php index 45bef915..292ec1e4 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php @@ -3,31 +3,25 @@ /** * Romanian PHPMailer language file: refer to English translation for definitive list * @package PHPMailer + * @author Alex Florea */ $PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Autentificarea a eșuat.'; -$PHPMAILER_LANG['buggy_php'] = 'Versiunea instalată de PHP este afectată de o problemă care poate duce la coruperea mesajelor Pentru a preveni această problemă, folosiți SMTP, dezactivați opțiunea mail.add_x_header din php.ini, folosiți MacOS/Linux sau actualizați versiunea de PHP la 7.0.17+ sau 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Conectarea la serverul SMTP a eșuat.'; $PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Datele nu au fost acceptate.'; $PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.'; $PHPMAILER_LANG['encoding'] = 'Encodare necunoscută: '; $PHPMAILER_LANG['execute'] = 'Nu se poate executa următoarea comandă: '; -$PHPMAILER_LANG['extension_missing'] = 'Lipsește extensia: '; $PHPMAILER_LANG['file_access'] = 'Nu se poate accesa următorul fișier: '; $PHPMAILER_LANG['file_open'] = 'Eroare fișier: Nu se poate deschide următorul fișier: '; $PHPMAILER_LANG['from_failed'] = 'Următoarele adrese From au dat eroare: '; $PHPMAILER_LANG['instantiate'] = 'Funcția mail nu a putut fi inițializată.'; $PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este validă: '; -$PHPMAILER_LANG['invalid_header'] = 'Numele sau valoarea header-ului nu este validă: '; -$PHPMAILER_LANG['invalid_hostentry'] = 'Hostentry invalid: '; -$PHPMAILER_LANG['invalid_host'] = 'Host invalid: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; $PHPMAILER_LANG['provide_address'] = 'Trebuie să adăugați cel puțin o adresă de email.'; $PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Următoarele adrese de email au eșuat: '; $PHPMAILER_LANG['signing'] = 'A aparut o problemă la semnarea emailului. '; -$PHPMAILER_LANG['smtp_code'] = 'Cod SMTP: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Informații SMTP adiționale: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a eșuat.'; -$PHPMAILER_LANG['smtp_detail'] = 'Detalii SMTP: '; $PHPMAILER_LANG['smtp_error'] = 'Eroare server SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. '; +$PHPMAILER_LANG['extension_missing'] = 'Lipsește extensia: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php index 8013f37c..8c8c5e81 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php @@ -5,32 +5,24 @@ * @package PHPMailer * @author Alexey Chumakov * @author Foster Snowhill - * @author ProjectSoft */ -$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: не удалось пройти аутентификацию.'; -$PHPMAILER_LANG['buggy_php'] = 'В вашей версии PHP есть ошибка, которая может привести к повреждению сообщений. Чтобы исправить, переключитесь на отправку по SMTP, отключите опцию mail.add_x_header в ваш php.ini, переключитесь на MacOS или Linux или обновите PHP до версии 7.0.17+ или 7.1.3+.'; +$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; $PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к SMTP-серверу.'; $PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.'; -$PHPMAILER_LANG['empty_message'] = 'Пустое сообщение'; $PHPMAILER_LANG['encoding'] = 'Неизвестная кодировка: '; $PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: '; -$PHPMAILER_LANG['extension_missing'] = 'Расширение отсутствует: '; $PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: '; $PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удаётся открыть файл: '; $PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: '; $PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail().'; -$PHPMAILER_LANG['invalid_address'] = 'Не отправлено из-за неправильного формата email-адреса: '; -$PHPMAILER_LANG['invalid_header'] = 'Неверное имя или значение заголовка'; -$PHPMAILER_LANG['invalid_hostentry'] = 'Неверная запись хоста: '; -$PHPMAILER_LANG['invalid_host'] = 'Неверный хост: '; +$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один email-адрес получателя.'; $PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый сервер не поддерживается.'; -$PHPMAILER_LANG['provide_address'] = 'Вы должны указать хотя бы один адрес электронной почты получателя.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: Ошибка следующих получателей: '; +$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: не удалась отправка таким адресатам: '; +$PHPMAILER_LANG['empty_message'] = 'Пустое сообщение'; +$PHPMAILER_LANG['invalid_address'] = 'Не отправлено из-за неправильного формата email-адреса: '; $PHPMAILER_LANG['signing'] = 'Ошибка подписи: '; -$PHPMAILER_LANG['smtp_code'] = 'Код SMTP: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Дополнительная информация SMTP: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером.'; -$PHPMAILER_LANG['smtp_detail'] = 'Детали: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером'; $PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: '; $PHPMAILER_LANG['variable_set'] = 'Невозможно установить или сбросить переменную: '; +$PHPMAILER_LANG['extension_missing'] = 'Расширение отсутствует: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php deleted file mode 100644 index dce502aa..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP දෝෂය: සත්‍යාපනය අසාර්ථක විය.'; -$PHPMAILER_LANG['buggy_php'] = 'ඔබගේ PHP version එකෙහි පවතින දෝෂයක් නිසා email පණිවිඩ දෝෂ සහගත වීමේ හැකියාවක් ඇත. මෙය විසදීම සදහා SMTP භාවිතා කිරීම, mail.add_x_header INI setting එක අක්‍රීය කිරීම, MacOS හෝ Linux වලට මාරු වීම, හෝ ඔබගේ PHP version එක 7.0.17+ හෝ 7.1.3+ වලට අලුත් කිරීම කරගන්න.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP දෝෂය: සම්බන්ධ වීමට නොහැකි විය.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP දෝෂය: දත්ත පිළිගනු නොලැබේ.'; -$PHPMAILER_LANG['empty_message'] = 'පණිවිඩ අන්තර්ගතය හිස්'; -$PHPMAILER_LANG['encoding'] = 'නොදන්නා කේතනය: '; -$PHPMAILER_LANG['execute'] = 'ක්‍රියාත්මක කළ නොහැකි විය: '; -$PHPMAILER_LANG['extension_missing'] = 'Extension එක නොමැත: '; -$PHPMAILER_LANG['file_access'] = 'File එකට ප්‍රවේශ විය නොහැකි විය: '; -$PHPMAILER_LANG['file_open'] = 'File දෝෂය: File එක විවෘත කළ නොහැක: '; -$PHPMAILER_LANG['from_failed'] = 'පහත From ලිපිනයන් අසාර්ථක විය: '; -$PHPMAILER_LANG['instantiate'] = 'mail function එක ක්‍රියාත්මක කළ නොහැක.'; -$PHPMAILER_LANG['invalid_address'] = 'වලංගු නොවන ලිපිනය: '; -$PHPMAILER_LANG['invalid_header'] = 'වලංගු නොවන header නාමයක් හෝ අගයක්'; -$PHPMAILER_LANG['invalid_hostentry'] = 'වලංගු නොවන hostentry එකක්: '; -$PHPMAILER_LANG['invalid_host'] = 'වලංගු නොවන host එකක්: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer සහාය නොදක්වයි.'; -$PHPMAILER_LANG['provide_address'] = 'ඔබ අවම වශයෙන් එක් ලබන්නෙකුගේ ඊමේල් ලිපිනයක් සැපයිය යුතුය.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP දෝෂය: පහත ලබන්නන් අසමත් විය: '; -$PHPMAILER_LANG['signing'] = 'Sign කිරීමේ දෝෂය: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP කේතය: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'අමතර SMTP තොරතුරු: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP සම්බන්ධය අසාර්ථක විය.'; -$PHPMAILER_LANG['smtp_detail'] = 'තොරතුරු: '; -$PHPMAILER_LANG['smtp_error'] = 'SMTP දෝෂය: '; -$PHPMAILER_LANG['variable_set'] = 'Variable එක සැකසීමට හෝ නැවත සැකසීමට නොහැක: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php index 3e00c259..c437a886 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php @@ -9,28 +9,23 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP napaka: Avtentikacija ni uspela.'; -$PHPMAILER_LANG['buggy_php'] = 'Na vašo PHP različico vpliva napaka, ki lahko povzroči poškodovana sporočila. Če želite težavo odpraviti, preklopite na pošiljanje prek SMTP, onemogočite možnost mail.add_x_header v vaši php.ini datoteki, preklopite na MacOS ali Linux, ali nadgradite vašo PHP zaličico na 7.0.17+ ali 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Vzpostavljanje povezave s SMTP gostiteljem ni uspelo.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP napaka: Strežnik zavrača podatke.'; $PHPMAILER_LANG['empty_message'] = 'E-poštno sporočilo nima vsebine.'; $PHPMAILER_LANG['encoding'] = 'Nepoznan tip kodiranja: '; $PHPMAILER_LANG['execute'] = 'Operacija ni uspela: '; -$PHPMAILER_LANG['extension_missing'] = 'Manjkajoča razširitev: '; $PHPMAILER_LANG['file_access'] = 'Nimam dostopa do datoteke: '; $PHPMAILER_LANG['file_open'] = 'Ne morem odpreti datoteke: '; $PHPMAILER_LANG['from_failed'] = 'Neveljaven e-naslov pošiljatelja: '; $PHPMAILER_LANG['instantiate'] = 'Ne morem inicializirati mail funkcije.'; $PHPMAILER_LANG['invalid_address'] = 'E-poštno sporočilo ni bilo poslano. E-naslov je neveljaven: '; -$PHPMAILER_LANG['invalid_header'] = 'Neveljavno ime ali vrednost glave'; $PHPMAILER_LANG['invalid_hostentry'] = 'Neveljaven vnos gostitelja: '; $PHPMAILER_LANG['invalid_host'] = 'Neveljaven gostitelj: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer ni podprt.'; $PHPMAILER_LANG['provide_address'] = 'Prosimo, vnesite vsaj enega naslovnika.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP napaka: Sledeči naslovniki so neveljavni: '; $PHPMAILER_LANG['signing'] = 'Napaka pri podpisovanju: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP koda: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'Dodatne informacije o SMTP: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'Ne morem vzpostaviti povezave s SMTP strežnikom.'; -$PHPMAILER_LANG['smtp_detail'] = 'Podrobnosti: '; $PHPMAILER_LANG['smtp_error'] = 'Napaka SMTP strežnika: '; $PHPMAILER_LANG['variable_set'] = 'Ne morem nastaviti oz. ponastaviti spremenljivke: '; +$PHPMAILER_LANG['extension_missing'] = 'Manjkajoča razširitev: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php index 3c45bc1c..f938f802 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php @@ -11,28 +11,21 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.'; -$PHPMAILER_LANG['buggy_php'] = 'PHP sürümünüz iletilerin bozulmasına neden olabilecek bir hatadan etkileniyor. Bunu düzeltmek için, SMTP kullanarak göndermeye geçin, mail.add_x_header seçeneğini devre dışı bırakın php.ini dosyanızdaki mail.add_x_header seçeneğini devre dışı bırakın, MacOS veya Linux geçin veya PHP sürümünü 7.0.17+ veya 7.1.3+ sürümüne yükseltin,'; $PHPMAILER_LANG['connect_host'] = 'SMTP Hatası: SMTP sunucusuna bağlanılamadı.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hatası: Veri kabul edilmedi.'; $PHPMAILER_LANG['empty_message'] = 'Mesajın içeriği boş'; $PHPMAILER_LANG['encoding'] = 'Bilinmeyen karakter kodlama: '; $PHPMAILER_LANG['execute'] = 'Çalıştırılamadı: '; -$PHPMAILER_LANG['extension_missing'] = 'Eklenti bulunamadı: '; $PHPMAILER_LANG['file_access'] = 'Dosyaya erişilemedi: '; $PHPMAILER_LANG['file_open'] = 'Dosya Hatası: Dosya açılamadı: '; $PHPMAILER_LANG['from_failed'] = 'Belirtilen adreslere gönderme başarısız: '; $PHPMAILER_LANG['instantiate'] = 'Örnek e-posta fonksiyonu oluşturulamadı.'; $PHPMAILER_LANG['invalid_address'] = 'Geçersiz e-posta adresi: '; -$PHPMAILER_LANG['invalid_header'] = 'Geçersiz başlık adı veya değeri: '; -$PHPMAILER_LANG['invalid_hostentry'] = 'Geçersiz ana bilgisayar girişi: '; -$PHPMAILER_LANG['invalid_host'] = 'Geçersiz ana bilgisayar: '; $PHPMAILER_LANG['mailer_not_supported'] = ' e-posta kütüphanesi desteklenmiyor.'; $PHPMAILER_LANG['provide_address'] = 'En az bir alıcı e-posta adresi belirtmelisiniz.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP Hatası: Belirtilen alıcılara ulaşılamadı: '; $PHPMAILER_LANG['signing'] = 'İmzalama hatası: '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP kodu: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'ek SMTP bilgileri: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.'; -$PHPMAILER_LANG['smtp_detail'] = 'SMTP SMTP Detayı: '; $PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: '; $PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: '; +$PHPMAILER_LANG['extension_missing'] = 'Eklenti bulunamadı: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php deleted file mode 100644 index 0b9de0f1..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php +++ /dev/null @@ -1,30 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP خرابی: تصدیق کرنے سے قاصر۔'; -$PHPMAILER_LANG['connect_host'] = 'SMTP خرابی: سرور سے منسلک ہونے سے قاصر۔'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP خرابی: ڈیٹا قبول نہیں کیا گیا۔'; -$PHPMAILER_LANG['empty_message'] = 'پیغام کی باڈی خالی ہے۔'; -$PHPMAILER_LANG['encoding'] = 'نامعلوم انکوڈنگ: '; -$PHPMAILER_LANG['execute'] = 'عمل کرنے کے قابل نہیں '; -$PHPMAILER_LANG['file_access'] = 'فائل تک رسائی سے قاصر:'; -$PHPMAILER_LANG['file_open'] = 'فائل کی خرابی: فائل کو کھولنے سے قاصر:'; -$PHPMAILER_LANG['from_failed'] = 'درج ذیل بھیجنے والے کا پتہ ناکام ہو گیا:'; -$PHPMAILER_LANG['instantiate'] = 'میل فنکشن کی مثال بنانے سے قاصر۔'; -$PHPMAILER_LANG['invalid_address'] = 'بھیجنے سے قاصر: غلط ای میل پتہ:'; -$PHPMAILER_LANG['mailer_not_supported'] = ' میلر تعاون یافتہ نہیں ہے۔'; -$PHPMAILER_LANG['provide_address'] = 'آپ کو کم از کم ایک منزل کا ای میل پتہ فراہم کرنا چاہیے۔'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP خرابی: درج ذیل پتہ پر نہیں بھیجا جاسکا: '; -$PHPMAILER_LANG['signing'] = 'دستخط کی خرابی: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP ملنا ناکام ہوا'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP سرور کی خرابی: '; -$PHPMAILER_LANG['variable_set'] = 'متغیر سیٹ نہیں کیا جا سکا: '; -$PHPMAILER_LANG['extension_missing'] = 'ایکٹینشن موجود نہیں ہے۔ '; -$PHPMAILER_LANG['smtp_code'] = 'SMTP سرور کوڈ: '; -$PHPMAILER_LANG['smtp_code_ex'] = 'اضافی SMTP سرور کی معلومات:'; -$PHPMAILER_LANG['invalid_header'] = 'غلط ہیڈر کا نام یا قدر'; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php index 03d49116..728a4994 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php @@ -9,13 +9,11 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; -$PHPMAILER_LANG['buggy_php'] = '您的 PHP 版本存在漏洞,可能会导致消息损坏。为修复此问题,请切换到使用 SMTP 发送,在您的 php.ini 中禁用 mail.add_x_header 选项。切换到 MacOS 或 Linux,或将您的 PHP 升级到 7.0.17+ 或 7.1.3+ 版本。'; $PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。'; $PHPMAILER_LANG['empty_message'] = '邮件正文为空。'; $PHPMAILER_LANG['encoding'] = '未知编码:'; $PHPMAILER_LANG['execute'] = '无法执行:'; -$PHPMAILER_LANG['extension_missing'] = '缺少扩展名:'; $PHPMAILER_LANG['file_access'] = '无法访问文件:'; $PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; $PHPMAILER_LANG['from_failed'] = '发送地址错误:'; @@ -24,13 +22,8 @@ $PHPMAILER_LANG['invalid_address'] = '发送失败,电子邮箱地址是 $PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。'; $PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:'; +$PHPMAILER_LANG['signing'] = '登录失败:'; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。'; $PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错:'; $PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:'; -$PHPMAILER_LANG['invalid_header'] = '无效的标题名称或值'; -$PHPMAILER_LANG['invalid_hostentry'] = '无效的hostentry: '; -$PHPMAILER_LANG['invalid_host'] = '无效的主机:'; -$PHPMAILER_LANG['signing'] = '签名错误:'; -$PHPMAILER_LANG['smtp_code'] = 'SMTP代码: '; -$PHPMAILER_LANG['smtp_code_ex'] = '附加SMTP信息: '; -$PHPMAILER_LANG['smtp_detail'] = '详情:'; +$PHPMAILER_LANG['extension_missing'] = '丢失模块 Extension:'; diff --git a/phpmailer/vendor/phpmailer/phpmailer/phpunit.xml.dist b/phpmailer/vendor/phpmailer/phpmailer/phpunit.xml.dist new file mode 100644 index 00000000..c68df965 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/phpunit.xml.dist @@ -0,0 +1,35 @@ + + + + + ./test/ + + + + + + + + languages + pop3 + + + + + ./src + + + + + + + + diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/DSNConfigurator.php b/phpmailer/vendor/phpmailer/phpmailer/src/DSNConfigurator.php deleted file mode 100644 index 7058c1f0..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/src/DSNConfigurator.php +++ /dev/null @@ -1,245 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2023 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -namespace PHPMailer\PHPMailer; - -/** - * Configure PHPMailer with DSN string. - * - * @see https://en.wikipedia.org/wiki/Data_source_name - * - * @author Oleg Voronkovich - */ -class DSNConfigurator -{ - /** - * Create new PHPMailer instance configured by DSN. - * - * @param string $dsn DSN - * @param bool $exceptions Should we throw external exceptions? - * - * @return PHPMailer - */ - public static function mailer($dsn, $exceptions = null) - { - static $configurator = null; - - if (null === $configurator) { - $configurator = new DSNConfigurator(); - } - - return $configurator->configure(new PHPMailer($exceptions), $dsn); - } - - /** - * Configure PHPMailer instance with DSN string. - * - * @param PHPMailer $mailer PHPMailer instance - * @param string $dsn DSN - * - * @return PHPMailer - */ - public function configure(PHPMailer $mailer, $dsn) - { - $config = $this->parseDSN($dsn); - - $this->applyConfig($mailer, $config); - - return $mailer; - } - - /** - * Parse DSN string. - * - * @param string $dsn DSN - * - * @throws Exception If DSN is malformed - * - * @return array Configuration - */ - private function parseDSN($dsn) - { - $config = $this->parseUrl($dsn); - - if (false === $config || !isset($config['scheme']) || !isset($config['host'])) { - throw new Exception('Malformed DSN'); - } - - if (isset($config['query'])) { - parse_str($config['query'], $config['query']); - } - - return $config; - } - - /** - * Apply configuration to mailer. - * - * @param PHPMailer $mailer PHPMailer instance - * @param array $config Configuration - * - * @throws Exception If scheme is invalid - */ - private function applyConfig(PHPMailer $mailer, $config) - { - switch ($config['scheme']) { - case 'mail': - $mailer->isMail(); - break; - case 'sendmail': - $mailer->isSendmail(); - break; - case 'qmail': - $mailer->isQmail(); - break; - case 'smtp': - case 'smtps': - $mailer->isSMTP(); - $this->configureSMTP($mailer, $config); - break; - default: - throw new Exception( - sprintf( - 'Invalid scheme: "%s". Allowed values: "mail", "sendmail", "qmail", "smtp", "smtps".', - $config['scheme'] - ) - ); - } - - if (isset($config['query'])) { - $this->configureOptions($mailer, $config['query']); - } - } - - /** - * Configure SMTP. - * - * @param PHPMailer $mailer PHPMailer instance - * @param array $config Configuration - */ - private function configureSMTP($mailer, $config) - { - $isSMTPS = 'smtps' === $config['scheme']; - - if ($isSMTPS) { - $mailer->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; - } - - $mailer->Host = $config['host']; - - if (isset($config['port'])) { - $mailer->Port = $config['port']; - } elseif ($isSMTPS) { - $mailer->Port = SMTP::DEFAULT_SECURE_PORT; - } - - $mailer->SMTPAuth = isset($config['user']) || isset($config['pass']); - - if (isset($config['user'])) { - $mailer->Username = $config['user']; - } - - if (isset($config['pass'])) { - $mailer->Password = $config['pass']; - } - } - - /** - * Configure options. - * - * @param PHPMailer $mailer PHPMailer instance - * @param array $options Options - * - * @throws Exception If option is unknown - */ - private function configureOptions(PHPMailer $mailer, $options) - { - $allowedOptions = get_object_vars($mailer); - - unset($allowedOptions['Mailer']); - unset($allowedOptions['SMTPAuth']); - unset($allowedOptions['Username']); - unset($allowedOptions['Password']); - unset($allowedOptions['Hostname']); - unset($allowedOptions['Port']); - unset($allowedOptions['ErrorInfo']); - - $allowedOptions = \array_keys($allowedOptions); - - foreach ($options as $key => $value) { - if (!in_array($key, $allowedOptions)) { - throw new Exception( - sprintf( - 'Unknown option: "%s". Allowed values: "%s"', - $key, - implode('", "', $allowedOptions) - ) - ); - } - - switch ($key) { - case 'AllowEmpty': - case 'SMTPAutoTLS': - case 'SMTPKeepAlive': - case 'SingleTo': - case 'UseSendmailOptions': - case 'do_verp': - case 'DKIM_copyHeaderFields': - $mailer->$key = (bool) $value; - break; - case 'Priority': - case 'SMTPDebug': - case 'WordWrap': - $mailer->$key = (int) $value; - break; - default: - $mailer->$key = $value; - break; - } - } - } - - /** - * Parse a URL. - * Wrapper for the built-in parse_url function to work around a bug in PHP 5.5. - * - * @param string $url URL - * - * @return array|false - */ - protected function parseUrl($url) - { - if (\PHP_VERSION_ID >= 50600 || false === strpos($url, '?')) { - return parse_url($url); - } - - $chunks = explode('?', $url); - if (is_array($chunks)) { - $result = parse_url($chunks[0]); - if (is_array($result)) { - $result['query'] = $chunks[1]; - } - return $result; - } - - return false; - } -} diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php b/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php index 09c1a2cf..a50a8991 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php +++ b/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php @@ -13,7 +13,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -35,6 +35,6 @@ class Exception extends \Exception */ public function errorMessage() { - return '' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "
\n"; + return '' . htmlspecialchars($this->getMessage()) . "
\n"; } } diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php b/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php index a7e95886..c93d0be1 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php +++ b/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php @@ -13,7 +13,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -29,11 +29,11 @@ use League\OAuth2\Client\Token\AccessToken; * OAuth - OAuth2 authentication wrapper class. * Uses the oauth2-client package from the League of Extraordinary Packages. * - * @see https://oauth2-client.thephpleague.com + * @see http://oauth2-client.thephpleague.com * * @author Marcus Bointon (Synchro/coolbru) */ -class OAuth implements OAuthTokenProvider +class OAuth { /** * An instance of the League OAuth Client Provider. diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php b/phpmailer/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php deleted file mode 100644 index cbda1a12..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2020 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ - -namespace PHPMailer\PHPMailer; - -/** - * OAuthTokenProvider - OAuth2 token provider interface. - * Provides base64 encoded OAuth2 auth strings for SMTP authentication. - * - * @see OAuth - * @see SMTP::authenticate() - * - * @author Peter Scopes (pdscopes) - * @author Marcus Bointon (Synchro/coolbru) - */ -interface OAuthTokenProvider -{ - /** - * Generate a base64-encoded OAuth token ensuring that the access token has not expired. - * The string to be base 64 encoded should be in the form: - * "user=\001auth=Bearer \001\001" - * - * @return string - */ - public function getOauth64(); -} diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php b/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php index 2444bcf3..eb4b742b 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php +++ b/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php @@ -13,7 +13,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -103,14 +103,14 @@ class PHPMailer * * @var string */ - public $From = ''; + public $From = 'root@localhost'; /** * The From name of the message. * * @var string */ - public $FromName = ''; + public $FromName = 'Root User'; /** * The envelope sender of the message. @@ -152,7 +152,8 @@ class PHPMailer * Only supported in simple alt or alt_inline message types * To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator. * - * @see https://kigkonsult.se/iCalcreator/ + * @see http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ + * @see http://kigkonsult.se/iCalcreator/ * * @var string */ @@ -253,7 +254,7 @@ class PHPMailer * You can set your own, but it must be in the format "", * as defined in RFC5322 section 3.6.4 or it will be ignored. * - * @see https://www.rfc-editor.org/rfc/rfc5322#section-3.6.4 + * @see https://tools.ietf.org/html/rfc5322#section-3.6.4 * * @var string */ @@ -349,24 +350,17 @@ class PHPMailer public $Password = ''; /** - * SMTP authentication type. Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2. - * If not specified, the first one from that list that the server supports will be selected. + * SMTP auth type. + * Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2, attempted in that order if not specified. * * @var string */ public $AuthType = ''; /** - * SMTP SMTPXClient command attributes + * An instance of the PHPMailer OAuth class. * - * @var array - */ - protected $SMTPXClient = []; - - /** - * An implementation of the PHPMailer OAuthTokenProvider interface. - * - * @var OAuthTokenProvider + * @var OAuth */ protected $oauth; @@ -387,7 +381,7 @@ class PHPMailer * 'DELAY' will notify you if there is an unusual delay in delivery, but the actual * delivery's outcome (success or failure) is not yet decided. * - * @see https://www.rfc-editor.org/rfc/rfc3461.html#section-4.1 for more information about NOTIFY + * @see https://tools.ietf.org/html/rfc3461 See section 4.1 for more information about NOTIFY */ public $dsn = ''; @@ -467,7 +461,7 @@ class PHPMailer * Only applicable when sending via SMTP. * * @see https://en.wikipedia.org/wiki/Variable_envelope_return_path - * @see https://www.postfix.org/VERP_README.html Postfix VERP info + * @see http://www.postfix.org/VERP_README.html Postfix VERP info * * @var bool */ @@ -550,10 +544,10 @@ class PHPMailer * The function that handles the result of the send email action. * It is called out by send() for each email sent. * - * Value can be any php callable: https://www.php.net/is_callable + * Value can be any php callable: http://www.php.net/is_callable * * Parameters: - * bool $result result of the send action + * bool $result result of the send action * array $to email addresses of the recipients * array $cc cc email addresses * array $bcc bcc email addresses @@ -580,10 +574,6 @@ class PHPMailer * May be a callable to inject your own validator, but there are several built-in validators. * The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option. * - * If CharSet is UTF8, the validator is left at the default value, - * and you send to addresses that use non-ASCII local parts, then - * PHPMailer automatically changes to the 'eai' validator. - * * @see PHPMailer::validateAddress() * * @var string|callable @@ -663,14 +653,6 @@ class PHPMailer */ protected $ReplyToQueue = []; - /** - * Whether the need for SMTPUTF8 has been detected. Set by - * preSend() if necessary. - * - * @var bool - */ - public $UseSMTPUTF8 = false; - /** * The array of attachments. * @@ -707,7 +689,7 @@ class PHPMailer protected $boundary = []; /** - * The array of available text strings for the current language. + * The array of available languages. * * @var array */ @@ -768,7 +750,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.10.0'; + const VERSION = '6.5.0'; /** * Error severity: message only, continue processing. @@ -813,7 +795,7 @@ class PHPMailer * The maximum line length supported by mail(). * * Background: mail() will sometimes corrupt messages - * with headers longer than 65 chars, see #818. + * with headers headers longer than 65 chars, see #818. * * @var int */ @@ -876,7 +858,7 @@ class PHPMailer private function mailPassthru($to, $subject, $body, $header, $params) { //Check overloading of mail function to avoid double-encoding - if ((int)ini_get('mbstring.func_overload') & 1) { + if (ini_get('mbstring.func_overload') & 1) { $subject = $this->secureHeader($subject); } else { $subject = $this->encodeHeader($this->secureHeader($subject)); @@ -914,7 +896,7 @@ class PHPMailer } //Is this a PSR-3 logger? if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) { - $this->Debugoutput->debug(rtrim($str, "\r\n")); + $this->Debugoutput->debug($str); return; } @@ -1083,9 +1065,9 @@ class PHPMailer * be modified after calling this function), addition of such addresses is delayed until send(). * Addresses that have been added already return false, but do not throw exceptions. * - * @param string $kind One of 'to', 'cc', 'bcc', or 'Reply-To' - * @param string $address The email address - * @param string $name An optional username associated with the address + * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' + * @param string $address The email address to send, resp. to reply to + * @param string $name * * @throws Exception * @@ -1093,11 +1075,9 @@ class PHPMailer */ protected function addOrEnqueueAnAddress($kind, $address, $name) { - $pos = false; - if ($address !== null) { - $address = trim($address); - $pos = strrpos($address, '@'); - } + $address = trim($address); + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + $pos = strrpos($address, '@'); if (false === $pos) { //At-sign is missing. $error_message = sprintf( @@ -1114,30 +1094,21 @@ class PHPMailer return false; } - if ($name !== null && is_string($name)) { - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - } else { - $name = ''; - } $params = [$kind, $address, $name]; //Enqueue addresses with IDN until we know the PHPMailer::$CharSet. - //Domain is assumed to be whatever is after the last @ symbol in the address - if ($this->has8bitChars(substr($address, ++$pos))) { - if (static::idnSupported()) { - if ('Reply-To' !== $kind) { - if (!array_key_exists($address, $this->RecipientsQueue)) { - $this->RecipientsQueue[$address] = $params; - - return true; - } - } elseif (!array_key_exists($address, $this->ReplyToQueue)) { - $this->ReplyToQueue[$address] = $params; + if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) { + if ('Reply-To' !== $kind) { + if (!array_key_exists($address, $this->RecipientsQueue)) { + $this->RecipientsQueue[$address] = $params; return true; } + } elseif (!array_key_exists($address, $this->ReplyToQueue)) { + $this->ReplyToQueue[$address] = $params; + + return true; } - //We have an 8-bit domain, but we are missing the necessary extensions to support it - //Or we are already sending to this address + return false; } @@ -1145,22 +1116,6 @@ class PHPMailer return call_user_func_array([$this, 'addAnAddress'], $params); } - /** - * Set the boundaries to use for delimiting MIME parts. - * If you override this, ensure you set all 3 boundaries to unique values. - * The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies, - * as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7 - * - * @return void - */ - public function setBoundaries() - { - $this->uniqueid = $this->generateId(); - $this->boundary[1] = 'b1=_' . $this->uniqueid; - $this->boundary[2] = 'b2=_' . $this->uniqueid; - $this->boundary[3] = 'b3=_' . $this->uniqueid; - } - /** * Add an address to one of the recipient arrays or to the ReplyTo array. * Addresses that have been added already return false, but do not throw exceptions. @@ -1175,15 +1130,6 @@ class PHPMailer */ protected function addAnAddress($kind, $address, $name = '') { - if ( - self::$validator === 'php' && - ((bool) preg_match('/[\x80-\xFF]/', $address)) - ) { - //The caller has not altered the validator and is sending to an address - //with UTF-8, so assume that they want UTF-8 support instead of failing - $this->CharSet = self::CHARSET_UTF8; - self::$validator = 'eai'; - } if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) { $error_message = sprintf( '%s: %s', @@ -1235,41 +1181,32 @@ class PHPMailer * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. * Note that quotes in the name part are removed. * - * @see https://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation + * @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation * * @param string $addrstr The address list string * @param bool $useimap Whether to use the IMAP extension to parse the list - * @param string $charset The charset to use when decoding the address list string. * * @return array */ - public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591) + public static function parseAddresses($addrstr, $useimap = true) { $addresses = []; if ($useimap && function_exists('imap_rfc822_parse_adrlist')) { //Use this built-in parser if it's available $list = imap_rfc822_parse_adrlist($addrstr, ''); - // Clear any potential IMAP errors to get rid of notices being thrown at end of script. - imap_errors(); foreach ($list as $address) { if ( - '.SYNTAX-ERROR.' !== $address->host && - static::validateAddress($address->mailbox . '@' . $address->host) + ('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress( + $address->mailbox . '@' . $address->host + ) ) { //Decode the name part if it's present and encoded if ( property_exists($address, 'personal') && - //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled - defined('MB_CASE_UPPER') && - preg_match('/^=\?.*\?=$/s', $address->personal) + extension_loaded('mbstring') && + preg_match('/^=\?.*\?=$/', $address->personal) ) { - $origCharset = mb_internal_encoding(); - mb_internal_encoding($charset); - //Undo any RFC2047-encoded spaces-as-underscores - $address->personal = str_replace('_', '=20', $address->personal); - //Decode the name $address->personal = mb_decode_mimeheader($address->personal); - mb_internal_encoding($origCharset); } $addresses[] = [ @@ -1297,16 +1234,9 @@ class PHPMailer $email = trim(str_replace('>', '', $email)); $name = trim($name); if (static::validateAddress($email)) { - //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled //If this name is encoded, decode it - if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) { - $origCharset = mb_internal_encoding(); - mb_internal_encoding($charset); - //Undo any RFC2047-encoded spaces-as-underscores - $name = str_replace('_', '=20', $name); - //Decode the name + if (preg_match('/^=\?.*\?=$/', $name)) { $name = mb_decode_mimeheader($name); - mb_internal_encoding($origCharset); } $addresses[] = [ //Remove any surrounding quotes and spaces from the name @@ -1334,7 +1264,7 @@ class PHPMailer */ public function setFrom($address, $name = '', $auto = true) { - $address = trim((string)$address); + $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim //Don't validate now addresses with IDN. Will be done in send(). $pos = strrpos($address, '@'); @@ -1386,7 +1316,6 @@ class PHPMailer * * `pcre` Use old PCRE implementation; * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. - * * `eai` Use a pattern similar to the HTML5 spec for 'email' and to firefox, extended to support EAI (RFC6530). * * `noregex` Don't use a regex: super fast, really dumb. * Alternatively you may pass in a callable to inject your own validator, for example: * @@ -1431,6 +1360,7 @@ class PHPMailer * * IPv6 literals: 'first.last@[IPv6:a1::]' * Not all of these will necessarily work for sending! * + * @see http://squiloople.com/2009/12/20/email-address-validation/ * @copyright 2009-2010 Michael Rushton * Feel free to use and redistribute this code. But please keep this copyright notice. */ @@ -1457,24 +1387,6 @@ class PHPMailer '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', $address ); - case 'eai': - /* - * This is the pattern used in the HTML5 spec for validation of 'email' type - * form input elements (as above), modified to accept Unicode email addresses. - * This is also more lenient than Firefox' html5 spec, in order to make the regex faster. - * 'eai' is an acronym for Email Address Internationalization. - * This validator is selected automatically if you attempt to use recipient addresses - * that contain Unicode characters in the local part. - * - * @see https://html.spec.whatwg.org/#e-mail-state-(type=email) - * @see https://en.wikipedia.org/wiki/International_email - */ - return (bool) preg_match( - '/^[-\p{L}\p{N}\p{M}.!#$%&\'*+\/=?^_`{|}~]+@[\p{L}\p{N}\p{M}](?:[\p{L}\p{N}\p{M}-]{0,61}' . - '[\p{L}\p{N}\p{M}])?(?:\.[\p{L}\p{N}\p{M}]' . - '(?:[-\p{L}\p{N}\p{M}]{0,61}[\p{L}\p{N}\p{M}])?)*$/usD', - $address - ); case 'php': default: return filter_var($address, FILTER_VALIDATE_EMAIL) !== false; @@ -1524,12 +1436,7 @@ class PHPMailer $errorcode = 0; if (defined('INTL_IDNA_VARIANT_UTS46')) { //Use the current punycode standard (appeared in PHP 7.2) - $punycode = idn_to_ascii( - $domain, - \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | - \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, - \INTL_IDNA_VARIANT_UTS46 - ); + $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_UTS46); } elseif (defined('INTL_IDNA_VARIANT_2003')) { //Fall back to this old, deprecated/removed encoding $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003); @@ -1601,33 +1508,21 @@ class PHPMailer && ini_get('mail.add_x_header') === '1' && stripos(PHP_OS, 'WIN') === 0 ) { - trigger_error($this->lang('buggy_php'), E_USER_WARNING); + 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 = ''; - //The code below tries to support full use of Unicode, - //while remaining compatible with legacy SMTP servers to - //the greatest degree possible: If the message uses - //Unicode in the local parts of any addresses, it is sent - //using SMTPUTF8. If not, it it sent using - //punycode-encoded domains and plain SMTP. - if ( - static::CHARSET_UTF8 === strtolower($this->CharSet) && - ($this->anyAddressHasUnicodeLocalPart($this->RecipientsQueue) || - $this->anyAddressHasUnicodeLocalPart(array_keys($this->all_recipients)) || - $this->anyAddressHasUnicodeLocalPart($this->ReplyToQueue) || - $this->addressHasUnicodeLocalPart($this->From)) - ) { - $this->UseSMTPUTF8 = true; - } //Dequeue recipient and Reply-To addresses with IDN foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) { - if (!$this->UseSMTPUTF8) { - $params[1] = $this->punyencodeAddress($params[1]); - } + $params[1] = $this->punyencodeAddress($params[1]); call_user_func_array([$this, 'addAnAddress'], $params); } if (count($this->to) + count($this->cc) + count($this->bcc) < 1) { @@ -1636,21 +1531,17 @@ class PHPMailer //Validate From, Sender, and ConfirmReadingTo addresses foreach (['From', 'Sender', 'ConfirmReadingTo'] as $address_kind) { - if ($this->{$address_kind} === null) { - $this->{$address_kind} = ''; + $this->$address_kind = trim($this->$address_kind); + if (empty($this->$address_kind)) { continue; } - $this->{$address_kind} = trim($this->{$address_kind}); - if (empty($this->{$address_kind})) { - continue; - } - $this->{$address_kind} = $this->punyencodeAddress($this->{$address_kind}); - if (!static::validateAddress($this->{$address_kind})) { + $this->$address_kind = $this->punyencodeAddress($this->$address_kind); + if (!static::validateAddress($this->$address_kind)) { $error_message = sprintf( '%s (%s): %s', $this->lang('invalid_address'), $address_kind, - $this->{$address_kind} + $this->$address_kind ); $this->setError($error_message); $this->edebug($error_message); @@ -1750,17 +1641,17 @@ class PHPMailer default: $sendMethod = $this->Mailer . 'Send'; if (method_exists($this, $sendMethod)) { - return $this->{$sendMethod}($this->MIMEHeader, $this->MIMEBody); + return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); } return $this->mailSend($this->MIMEHeader, $this->MIMEBody); } } catch (Exception $exc) { - $this->setError($exc->getMessage()); - $this->edebug($exc->getMessage()); - if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true && $this->smtp->connected()) { + if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) { $this->smtp->reset(); } + $this->setError($exc->getMessage()); + $this->edebug($exc->getMessage()); if ($this->exceptions) { throw $exc; } @@ -1792,13 +1683,11 @@ class PHPMailer //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver //A space after `-f` is optional, but there is a long history of its presence //causing problems, so we don't use one - //Exim docs: https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html - //Sendmail docs: https://www.sendmail.org/~ca/email/man/sendmail.html + //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html + //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html + //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html //Example problem: https://www.drupal.org/node/1057954 - - //PHP 5.6 workaround - $sendmail_from_value = ini_get('sendmail_from'); - if (empty($this->Sender) && !empty($sendmail_from_value)) { + if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } @@ -1835,7 +1724,7 @@ class PHPMailer fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); - $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); + $addrinfo = static::parseAddresses($toAddr); $this->doCallback( ($result === 0), [[$addrinfo['address'], $addrinfo['name']]], @@ -1890,13 +1779,7 @@ class PHPMailer */ protected static function isShellSafe($string) { - //It's not possible to use shell commands safely (which includes the mail() function) without escapeshellarg, - //but some hosting providers disable it, creating a security problem that we don't want to have to deal with, - //so we don't. - if (!function_exists('escapeshellarg') || !function_exists('escapeshellcmd')) { - return false; - } - + //Future-proof if ( escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), ["'$string'", "\"$string\""]) @@ -1931,7 +1814,7 @@ class PHPMailer */ protected static function isPermittedPath($path) { - //Matches scheme definition from https://www.rfc-editor.org/rfc/rfc3986#section-3.1 + //Matches scheme definition from https://tools.ietf.org/html/rfc3986#section-3.1 return !preg_match('#^[a-z][a-z\d+.-]*://#i', $path); } @@ -1947,7 +1830,7 @@ class PHPMailer if (!static::isPermittedPath($path)) { return false; } - $readable = is_file($path); + $readable = file_exists($path); //If not a UNC path (expected to start with \\), check read permission, see #2069 if (strpos($path, '\\\\') !== 0) { $readable = $readable && is_readable($path); @@ -1958,7 +1841,7 @@ class PHPMailer /** * Send mail using the PHP mail() function. * - * @see https://www.php.net/manual/en/book.mail.php + * @see http://www.php.net/manual/en/book.mail.php * * @param string $header The message headers * @param string $body The message body @@ -1975,27 +1858,18 @@ class PHPMailer foreach ($this->to as $toaddr) { $toArr[] = $this->addrFormat($toaddr); } - $to = trim(implode(', ', $toArr)); - - //If there are no To-addresses (e.g. when sending only to BCC-addresses) - //the following should be added to get a correct DKIM-signature. - //Compare with $this->preSend() - if ($to === '') { - $to = 'undisclosed-recipients:;'; - } + $to = implode(', ', $toArr); $params = null; //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver //A space after `-f` is optional, but there is a long history of its presence //causing problems, so we don't use one - //Exim docs: https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html - //Sendmail docs: https://www.sendmail.org/~ca/email/man/sendmail.html + //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html + //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html + //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html //Example problem: https://www.drupal.org/node/1057954 //CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. - - //PHP 5.6 workaround - $sendmail_from_value = ini_get('sendmail_from'); - if (empty($this->Sender) && !empty($sendmail_from_value)) { + if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } @@ -2010,7 +1884,7 @@ class PHPMailer if ($this->SingleTo && count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); - $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); + $addrinfo = static::parseAddresses($toAddr); $this->doCallback( $result, [[$addrinfo['address'], $addrinfo['name']]], @@ -2064,38 +1938,6 @@ class PHPMailer return $this->smtp; } - /** - * Provide SMTP XCLIENT attributes - * - * @param string $name Attribute name - * @param ?string $value Attribute value - * - * @return bool - */ - public function setSMTPXclientAttribute($name, $value) - { - if (!in_array($name, SMTP::$xclient_allowed_attributes)) { - return false; - } - if (isset($this->SMTPXClient[$name]) && $value === null) { - unset($this->SMTPXClient[$name]); - } elseif ($value !== null) { - $this->SMTPXClient[$name] = $value; - } - - return true; - } - - /** - * Get SMTP XCLIENT attributes - * - * @return array - */ - public function getSMTPXclientAttributes() - { - return $this->SMTPXClient; - } - /** * Send mail via SMTP. * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. @@ -2118,20 +1960,12 @@ class PHPMailer if (!$this->smtpConnect($this->SMTPOptions)) { throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); } - //If we have recipient addresses that need Unicode support, - //but the server doesn't support it, stop here - if ($this->UseSMTPUTF8 && !$this->smtp->getServerExt('SMTPUTF8')) { - throw new Exception($this->lang('no_smtputf8'), self::STOP_CRITICAL); - } //Sender already validated in preSend() if ('' === $this->Sender) { $smtp_from = $this->From; } else { $smtp_from = $this->Sender; } - if (count($this->SMTPXClient)) { - $this->smtp->xclient($this->SMTPXClient); - } if (!$this->smtp->mail($smtp_from)) { $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); throw new Exception($this->ErrorInfo, self::STOP_CRITICAL); @@ -2224,10 +2058,6 @@ class PHPMailer $this->smtp->setDebugLevel($this->SMTPDebug); $this->smtp->setDebugOutput($this->Debugoutput); $this->smtp->setVerp($this->do_verp); - $this->smtp->setSMTPUTF8($this->UseSMTPUTF8); - if ($this->Host === null) { - $this->Host = 'localhost'; - } $hosts = explode(';', $this->Host); $lastexception = null; @@ -2295,23 +2125,15 @@ class PHPMailer $this->smtp->hello($hello); //Automatically enable TLS encryption if: //* it's not disabled - //* we are not connecting to localhost //* we have openssl extension //* we are not already using SSL //* the server offers STARTTLS - if ( - $this->SMTPAutoTLS && - $this->Host !== 'localhost' && - $sslext && - $secure !== 'ssl' && - $this->smtp->getServerExt('STARTTLS') - ) { + if ($this->SMTPAutoTLS && $sslext && 'ssl' !== $secure && $this->smtp->getServerExt('STARTTLS')) { $tls = true; } if ($tls) { if (!$this->smtp->startTLS()) { - $message = $this->getSmtpErrorMessage('connect_host'); - throw new Exception($message); + throw new Exception($this->lang('connect_host')); } //We must resend EHLO after TLS negotiation $this->smtp->hello($hello); @@ -2342,11 +2164,6 @@ class PHPMailer if ($this->exceptions && null !== $lastexception) { throw $lastexception; } - if ($this->exceptions) { - // no exception was thrown, likely $this->smtp->connect() failed - $message = $this->getSmtpErrorMessage('connect_host'); - throw new Exception($message); - } return false; } @@ -2364,15 +2181,14 @@ class PHPMailer /** * Set the language for error messages. + * Returns false if it cannot load the language file. * The default language is English. * * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") - * Optionally, the language code can be enhanced with a 4-character - * script annotation and/or a 2-character country annotation. - * @param string $lang_path Path to the language file directory, with trailing separator (slash) + * @param string $lang_path Path to the language file directory, with trailing separator (slash).D * Do not set this from user input! * - * @return bool Returns true if the requested language was loaded, false otherwise. + * @return bool */ public function setLanguage($langcode = 'en', $lang_path = '') { @@ -2395,78 +2211,44 @@ class PHPMailer //Define full set of translatable strings in English $PHPMAILER_LANG = [ 'authenticate' => 'SMTP Error: Could not authenticate.', - 'buggy_php' => '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+.', 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', 'data_not_accepted' => 'SMTP Error: data not accepted.', 'empty_message' => 'Message body empty', 'encoding' => 'Unknown encoding: ', 'execute' => 'Could not execute: ', - 'extension_missing' => 'Extension missing: ', 'file_access' => 'Could not access file: ', 'file_open' => 'File Error: Could not open file: ', 'from_failed' => 'The following From address failed: ', 'instantiate' => 'Could not instantiate mail function.', 'invalid_address' => 'Invalid address: ', - 'invalid_header' => 'Invalid header name or value', 'invalid_hostentry' => 'Invalid hostentry: ', 'invalid_host' => 'Invalid host: ', 'mailer_not_supported' => ' mailer is not supported.', 'provide_address' => 'You must provide at least one recipient email address.', 'recipients_failed' => 'SMTP Error: The following recipients failed: ', 'signing' => 'Signing Error: ', - 'smtp_code' => 'SMTP code: ', - 'smtp_code_ex' => 'Additional SMTP info: ', 'smtp_connect_failed' => 'SMTP connect() failed.', - 'smtp_detail' => 'Detail: ', 'smtp_error' => 'SMTP server error: ', 'variable_set' => 'Cannot set or reset variable: ', - 'no_smtputf8' => 'Server does not support SMTPUTF8 needed to send to Unicode addresses', + 'extension_missing' => 'Extension missing: ', ]; if (empty($lang_path)) { //Calculate an absolute path so it can work if CWD is not here $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR; } - //Validate $langcode - $foundlang = true; - $langcode = strtolower($langcode); - if ( - !preg_match('/^(?P[a-z]{2})(?P - - -
-

- {{$title}} - {{$page}} ({{$count}}) - -

-
- - - - - - - {{foreach $th_users as $k=>$th}} - {{if $k < 2 || $order_users == $th.1 || ($k==4 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1])) }} - - {{/if}} - {{/foreach}} - - - - - {{foreach $users as $u}} - - - - - - {{if $order_users == $th_users.2.1}} - - {{/if}} - - {{if $order_users == $th_users.3.1}} - - {{/if}} - - {{if $order_users == $th_users.5.1}} - - {{/if}} - - {{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1]) }} - - {{/if}} - - - - - - - - - {{/foreach}} - -
- - {{if $order_users == $th.1}} - {{if $order_direction_users == "+"}} - ↓ - {{else}} - ↑ - {{/if}} - {{else}} - ↕ - {{/if}} - {{$th.0}} - -
{{$u.name}}{{$u.email}}{{$u.register_date}}{{$u.login_date}} - - - {{if $u.page_flags_raw==0 && $u.account_type_raw > 0}} - - {{/if}} - {{if $u.is_admin}}{{/if}} - {{if $u.account_expired}}{{/if}} - {{$u.lastitem_date}} - -
- {{$pager nofilter}} -
-
diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index 4523d911..731cf003 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -7,6 +7,7 @@ * */ +use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -59,7 +60,7 @@ function rendertime_page_end(string &$o) if (DI::userSession()->isSiteAdmin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) { - $o = $o . '