php / php/php-src

Check UTF-8 validity for all constant strings on compile time

Open
#10,853 3 comments 0 reactions 1 assignee View on GitHub

@iluuu1994 is already working on this.

Since Mar 17, 2023.

Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

Currently the UTF-8 string validity is checked on demand and cached the string if not interned.

However:

  • when a string is interned, such flag cannot be cached on runtime (at least not due TS)
  • it is not stored back to the source script cache/opcache, ie. the validity is checked on every request at least once
  • when a string is created from unvalidated source before checking, the validation cannot be cached
  • currently only "valid UTF-8" flag is cached , but when a string is "invalid UTF-8", nothing is cached at all

This is a feature request to:
a) check UTF-8 validity on compile time on every const string
b) store a flag if UTF-8 validity was checked or not

Thanks to #10436 the UTF-8 validity check is very fast and the compile time impact should be minimal.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.