phpmyadmin / phpmyadmin/motranslator

[6.x] Evaluation incorrect, returning false for 1

Open Beginner friendly
#58 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
62
Forks
25
PR merge metrics
No merged PRs in 30d

Description

https://github.com/phpmyadmin/motranslator/blob/cb7c94ba907d65d12ef870eb2e54a6a7793a431c/src/Translator.php#L254

$plural = is_numeric($evaluatedPlural) ? (int) $evaluatedPlural : 0;

$evaluatedPlural should be int 1 but instead it's true coerced to 1, therefore is_numeric(true) returns false and the plural form fails to be correctly detected.

Using PHP 8.2.

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 at src/Translator.php line 254 and inspect how the evaluated plural expression is handled on PHP 8.2. Reproduce the case where the evaluated value should be integer 1 but becomes true, then verify that the plural form is detected correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
internationalization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.