Skip to content

number_format(): 'multi-byte separator not supported' is misreported when separator is empty. #1679

@MarkMaldaba

Description

@MarkMaldaba

Minimal test file

<?php
print(number_format(1234, 2, '.', ''));

Command line

phpcs -ps file.php --standard=PHPCompatibility --runtime-set testVersion 5.0-

Expected Behaviour

No compatibility issue reported. The empty string is not a multi-byte character.

Actual Behaviour

E 1 / 1 (100%)



FILE: D:\PHP Compatibility Testing\file.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
 2 | ERROR | Passing a multi-byte separator as the $thousands_separator to number_format() is not supported in PHP 5.3
   |       | or earlier. Found: ""
------------------------------------------------------------------------------------------------------------------------

Time: 184ms; Memory: 10MB

Environment

Environment Answer
PHP version 7.4.13
PHP_CodeSniffer version 3.7.2 (stable)
PHPCSUtils version ???
PHPCompatibility version develop @ 34a67f7
Install type git

Tested Against develop branch?

  • I have verified the issue still exists in the develop branch of PHPCompatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions