lukeyouell / craft-sentry

Error tracking that helps developers monitor and fix crashes in real time. Iterate continuously. Boost efficiency. Improve user experience.
https://sentry.io
MIT License
17 stars 10 forks source link

No support for PHP 7.4 due to old Sentry #24

Open msiemens opened 4 years ago

msiemens commented 4 years ago

When using this plugin with PHP 7.4, the following error is thrown:

PHP Fatal error:  Uncaught yii\base\ErrorException: Array and string offset access syntax with curly braces is deprecated in vendor/sentry/sentry/lib/Raven/Client.php:331
Stack trace:
#0 vendor/craftcms/cms/src/web/ErrorHandler.php(74): yii\base\ErrorHandler->handleError()
#1 vendor/composer/ClassLoader.php(444): craft\web\ErrorHandler->handleError()
#2 vendor/composer/ClassLoader.php(444): include()
#3 vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#4 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#5 vendor/lukeyouell/craft-sentry/src/services/SentryService.php(69): spl_autoload_call()
#6 vendor/lukeyouell/craft-sentry/src/Sentry.php(37): luke in vendor/sentry/sentry/lib/Raven/Client.php on line 331

The relevant lines from sentry/lib/Raven/Client.php::

if ($path{0} === DIRECTORY_SEPARATOR && substr($path, -1) !== DIRECTORY_SEPARATOR) {
    $path .= DIRECTORY_SEPARATOR;
}

Seems like the Sentry SDK is used in version 1.x which uses the curly brace syntax for string offset. This syntax has been deprecated with PHP 7.4 and throws a runtime error.

I guess the only way to get it to work with PHP 7.4 would be updating to Sentry 2.

karensg commented 4 years ago

Agree, would be great to upgrade to Sentry 2 sdk indeed.

harispepic commented 4 years ago

@lukeyouell are any updates planned?

janhenckens commented 4 years ago

Needed this as well. Happy to jump in with a PR if that helps @lukeyouell

OscarBarrett commented 3 years ago

There's an alternative plugin that uses the latest SDK: https://github.com/born05/craft-sentry