Skip to content

ext/intl: PHP appears to under-expose Spoofchecker functionality on ICU 57.x #22053

@LamentXU123

Description

@LamentXU123

Description

According to build/php.m4, PHP's ICU minimum is currently 57.1. And as per the ICU doc, ICU already provides the restriction-level API before ICU 57:

However, every above constants or functions could only be used under ICU >= 58 in php. There is a hard version guard against them, which means if someone build php under ICU 57.x (though it is really, really rare) the guy might have trouble dealing with those APIs in php interface since they are only valid under ICU >= 58.

the source of those is

  #if U_ICU_VERSION_MAJOR_NUM >= 58
      public const int ASCII = UNKNOWN;
      public const int HIGHLY_RESTRICTIVE = UNKNOWN;
      public const int MODERATELY_RESTRICTIVE = UNKNOWN;
      public const int MINIMALLY_RESTRICTIVE = UNKNOWN;
      public const int UNRESTRICTIVE = UNKNOWN;
      public const int SINGLE_SCRIPT_RESTRICTIVE = UNKNOWN;
      public const int MIXED_NUMBERS = UNKNOWN;
  #endif

  #if U_ICU_VERSION_MAJOR_NUM >= 58
      public function setRestrictionLevel(int $level): void {}
  #endif

There seems to be much more APIs that is supported in ICU 57.x which is clearly supported in php, and could only be used under ICU >= 58, across the intl code base. At this point I don't even sure if we actually care about ICU < 58

I don't sure if we should treat this as a new feature request or a bug report. cc @devnexen if you have enough time on this topic. Or I'd be happy to work on this in this weekend :)

PHP Version

all versions

Operating System

N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions