Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2 Compatibility #590

Closed
danielmorell opened this issue Jan 2, 2023 · 1 comment · Fixed by #606
Closed

PHP 8.2 Compatibility #590

danielmorell opened this issue Jan 2, 2023 · 1 comment · Fixed by #606
Assignees
Labels
Rank: 2 - Major Tackle when there are no actionable Critical requests. Status: 3 - Construction The request is being worked on.
Milestone

Comments

@danielmorell
Copy link
Collaborator

With the release of PHP 8.2 there were a number of things that were deprecated. Fortunately, only one appears to impact the Rollbar PHP package. It is Deprecate dynamic properties.

We use dynamic properties to keep track of errors and exceptions that were explicitly passed to the Rollbar or "caught" by the handlers via the isUncaught property.

This can easily be fixed in both our error handler and fatal error handler since we use our own ErrorWrapper class, and we can just declare the property in it. For the exception handler we will need to think through how we handle it.

@danielmorell danielmorell added the Rank: 2 - Major Tackle when there are no actionable Critical requests. label Jan 2, 2023
@danielmorell danielmorell added this to the v4.0.0 milestone Jan 2, 2023
@danielmorell danielmorell self-assigned this Jan 2, 2023
@danielmorell danielmorell mentioned this issue Feb 16, 2023
1 task
@danielmorell danielmorell added the Status: 3 - Construction The request is being worked on. label Feb 16, 2023
@danielmorell
Copy link
Collaborator Author

I wrote a test to validate this in commit 8d5fb81. The output on PHP 8.2 is as follows...

There was 1 failure:

1) Rollbar\Handlers\ExceptionHandlerTest::testDeprecatedDynamicProperties
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
-Array &0 ()
+Array &0 (
+    0 => Array &1 (
+        'errno' => [81](https://github.com/rollbar/rollbar-php/actions/runs/4226642287/jobs/7340297286#step:7:82)92
+        'errstr' => 'Creation of dynamic property Exception::$isUncaught is deprecated'
+        'errfile' => '/home/runner/work/rollbar-php/rollbar-php/src/Handlers/ExceptionHandler.php'
+        'errline' => 27
+    )
+)

/home/runner/work/rollbar-php/rollbar-php/tests/Handlers/ExceptionHandlerTest.php:120

This validates, the deprecation warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rank: 2 - Major Tackle when there are no actionable Critical requests. Status: 3 - Construction The request is being worked on.
Projects
None yet
1 participant