getsentry / sentry-php

The official PHP SDK for Sentry (sentry.io)

Home Page:https://sentry.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP7 compatibility

ohtyap opened this issue · comments

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

^4.3

Steps to reproduce

DebugStdOutLogger and DebugFileLogger are having this method signature:

public function log($level, \Stringable|string $message, array $context = []): void

This isn't compatible with PHP7

Expected result

The code should be either compatible with "php": "^7.2|^8.0" (as defined in composer.json) or the php requirement in composer.json should remove ^7.2

Actual result

Syntax error when using within PHP7.

The logger we provide is only compatible with the current PSR3 logger interface. We will add additional loggers in the future, for now, please create your own.

On a site with PHP PHP 8.0.28 and composer 2.2.18, after installing sentry/sentry 4.4.0, I'm getting the error:

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".

These are issues bound to your dev environment or other dependencies: your last execution of Composer was done under PHP 8.1 (probably locally) and you produced a composer.lock for that version. Use a proper local dev environment with the right version of PHP to fix it.

The logger we provide is only compatible with the current PSR3 logger interface.

@cleptric the PSR-3 has been updated that way, but you still may use the previous signature (with wider argument types, but stricter return type) and maintain backward compatibility, see PSR Evolution for further details. As a practical example, see: https://3v4l.org/GivGp

@ohtyap The fix went out in 4.5.0