close
Skip to content

Error control operator may trigger a fatal error with PHP 8.0 #2066

@benoitchantre

Description

@benoitchantre

Is your feature request related to a problem?

In many plugins, I have noticed an issue with the error control operator @ used with set_time_limit().

The error happens when PHP 8.0 is used and when set_time_limit() has been disabled on the server.

Prior to PHP 8.0.0, it was possible for the @ operator to disable critical errors that will terminate script execution. For example, prepending @ to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why.
https://www.php.net/manual/en/language.operators.errorcontrol.php

Describe the solution you'd like

I think the sniffs should look for the error operator and trigger a warning.

Additional context (optional)

  • PHP 8.0
  • any disabled function used with the error operator

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions