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

Fix error suppressor context detection for PHP 8 #565

Merged

Conversation

tanakahisateru
Copy link
Contributor

@tanakahisateru tanakahisateru commented Apr 12, 2022

Description of the change

I upgraded PHP and Rollber client then too many errors are reported. I'm using @ operator.
PHP 8 changed error_reporting() return value when it used with @.

https://www.php.net/manual/en/language.operators.errorcontrol.php

<?php
function f() {
    echo error_reporting(), PHP_EOL;
}

error_reporting (E_ALL);
f();    // -1
@f();   // PHP7:0 / PHP8:4437

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Shortcut stories and GitHub issues (delete irrelevant)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

@danielmorell danielmorell mentioned this pull request Apr 25, 2022
12 tasks
@dimkax94
Copy link

dimkax94 commented May 12, 2022

Hi @danielmorell @cyrusradfar @tanakahisateru
I'm looking forward to this fix, so i want to add some context here.

Some laravel cli commands (like route:clear, config:clear) use @unlink under the hood without checking file's presence. After migrating our Laravel applications on php 8.1 from 7.4, we started getting rollbar notifications like E_WARNING: unlink(/path-to-project/bootstrap/cache/config.php): No such file or directory.
As errors are suppressed, these notifications are considered as "false-positive"

Because route:cache, config:cache commands call the underlying *:clear commands, we get them each time a Laravel app is deployed.

@danielmorell
Copy link
Collaborator

Hi @dimkax94, thank you for the extra insight. That helps make the case for this a little clearer.

Copy link
Collaborator

@danielmorell danielmorell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tanakahisateru for your work on this!

@danielmorell danielmorell merged commit bfc25e5 into rollbar:master May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants