Skip to content

feat: add PHP mb_strtolower (AOT + Magician) - #899

Open
nahime0 wants to merge 7 commits into
mainfrom
cursor/mb-strtolower-3f33
Open

feat: add PHP mb_strtolower (AOT + Magician)#899
nahime0 wants to merge 7 commits into
mainfrom
cursor/mb-strtolower-3f33

Conversation

@nahime0

@nahime0 nahime0 commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Adds PHP mb_strtolower(string $string, ?string $encoding = null): string on both AOT and Magician/eval(), matching PHP 8.5 UTF-8 full-lowercase semantics.

  • Omitted / null / UTF-8 / UTF8 apply Unicode full lowercase, including Final_Sigma (Σς at end of word) and 1:N maps such as İi + combining dot.
  • 8bit / binary / 7bit lowercase ASCII A-Z per byte.
  • Unknown encodings raise a catchable \ValueError.
  • Other encodings are not iconv-decoded; this is UTF-8 semantics only.

Follows the existing mb_strlen contract / Magician / AOT / test / docs pattern.

Testing

Focused coverage on linux-x86_64 (CI covers the remaining target matrix):

  • AOT codegen: ASCII, Latin-1, 1:N İ, Final_Sigma, 8bit vs UTF-8, named/null encoding, first-class callable, malformed UTF-8, namespace/case-insensitive lookup
  • Error tests: arity and type checks
  • Eval parity + Magician interpreter tests
  • Generated builtin docs + registry sync
cargo test --test codegen_tests test_mb_strtolower
cargo test --test error_tests test_error_mb_strtolower
cargo test --test codegen_tests test_eval_mb_strtolower
cargo test -p elephc-magician execute_program_dispatches_mb_strtolower

All of the above passed locally. A compiled demo produced:

hello world
héllo
i̇stanbul
ος
bg-red
68c3896c6c6f
caught
Open in Web Open in Cursor 

cursoragent and others added 4 commits September 5, 2026 10:31
Declare PHP mb_strtolower in the shared catalog and wire AOT builtin
semantics plus Magician eval hooks to the new runtime.mb_strtolower target.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Add __rt_mb_strtolower with PHP 8.5 UTF-8 full lowercase, Final_Sigma,
1:N maps, and ASCII-byte encodings on AArch64 and Linux x86_64.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Add codegen, error, eval-parity, and Magician tests for UTF-8 lowercase,
Final_Sigma, byte encodings, callables, and unknown-encoding ValueError.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Record PHP 8.5 UTF-8 lowercase in user docs, internals, ROADMAP, the
string-ops example, and the generated builtin registry pages.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
@github-actions github-actions Bot added area:builtins Touches PHP builtin declarations or emitters. area:magician Touches eval, include execution, or elephc-magician. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. scope:multi-area Touches more compiler areas than the automatic area-label cap. size:xl Very large pull request that needs deliberate review planning. type:feature Introduces new user-visible behavior or capabilities. labels Sep 5, 2026
Valid letters before a malformed byte still lowercase; only the invalid
group is copied unchanged.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
@nahime0
nahime0 marked this pull request as ready for review September 5, 2026 10:33
@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown

Too many files changed for review (280 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

cursoragent and others added 2 commits September 5, 2026 14:41
The shared catalog grew by one PHP-visible builtin. Update the
default-feature and curl-feature count gates so Non-Codegen and
Curl feature contract coverage stay aligned.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Refresh the generated compatibility page so mbstring coverage
and overall builtin counts match the new catalog entry.

Co-authored-by: Vincenzo Petrucci <nahime0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:builtins Touches PHP builtin declarations or emitters. area:magician Touches eval, include execution, or elephc-magician. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. scope:multi-area Touches more compiler areas than the automatic area-label cap. size:xl Very large pull request that needs deliberate review planning. type:feature Introduces new user-visible behavior or capabilities.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants