magento / magento/magento-coding-standard

Remove PHP `assert()` function from list of forbidden functions

Open
#489 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Progress: ready for grooming
Dominant language
PHP
Stars
375
Forks
165
PR merge metrics
No merged PRs in 30d

Description

Description

AFAIK starting from PHP 8.0 the main security issue of assert() function implementation is removed. Thus given the minimum PHP requirement version for the Coding Standards is 8.1 the function should be removed from the list of the forbidden functions.

Expected behavior

No error The use of function assert() is forbidden is shown when checking the standards on Magento code.

Benefits

The function usage is allowed which provides reducing of boilerplate in code base.

Additional information

I'm not a security expert, so I might be wrong on the topic.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the configuration that defines forbidden PHP functions and any tests covering forbidden-function diagnostics. Confirm the PHP 8.1 behavior and update the relevant expectation so Magento code using assert() no longer produces the reported error; done means the focused checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.