Skip to content

Stdlib: ceil, floor, intval and expanded PHPT specs - #3

Merged
cursor[bot] merged 2 commits into
masterfrom
cursor/php-compiler-stdlib-d54d
May 17, 2026
Merged

Stdlib: ceil, floor, intval and expanded PHPT specs#3
cursor[bot] merged 2 commits into
masterfrom
cursor/php-compiler-stdlib-d54d

Conversation

@cursor

@cursor cursor Bot commented May 17, 2026

Copy link
Copy Markdown

Summary

This change extends the compiler’s standard library surface and test coverage.

Implementations

  • ceil and floor: VM execution mirrors PHP for integer and float operands. JIT lowers to libm-style double fn(double) declarations registered from ext\standard\Module::jitInit() when missing, with integer arguments promoted via siToFp.
  • intval: Subset behaviour for integer and float only—integers pass through; floats truncate toward zero, matching an (int) cast.

Specs

  • New compliance PHPT cases: ceil, floor, intval, str_repeat with multiplier zero, and negative-operand intdiv.
  • test/real/cases/stdlib_digest.phpt updated to exercise ceil / floor chained through intval.

Notes

  • intval intentionally does not accept strings in this build (throws like other narrow builtins).
  • JIT ceil/floor rely on linking against the platform math library for the declared symbols.
Open in Web View Automation 

cursoragent and others added 2 commits May 17, 2026 07:04
Register double ceil(double) and floor(double) in standard module jitInit
when not already present. VM paths mirror PHP for int/float operands;
intval truncates floats toward zero per (int) cast semantics.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Add compliance cases for ceil, floor, intval, str_repeat edge cases,
and negative intdiv. Extend real-world digest to chain ceil/floor
through intval.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review May 17, 2026 07:04
@cursor
cursor Bot merged commit 9d3c389 into master May 17, 2026
PurHur added a commit that referenced this pull request May 23, 2026
Wire array/filesystem/scope/numeric call() paths through Internal::jitString(),
JitLongArg, and jitBool; expand SelfHostBuiltinPolicy bundle categories; add
AOT lint fixtures for stdlib array ops and filesystem probes.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur deleted the cursor/php-compiler-stdlib-d54d branch June 24, 2026 04:28
PurHur added a commit that referenced this pull request Aug 16, 2026
…1588)

Invalid mode used the __construct arg #3 citation for setMode; pass a caller-specific where string so Zend wording matches.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 26, 2026
…5151) (#35154)

TITLE/TITLE_SIMPLE still required a compile-time encoding literal while
UPPER/LOWER already accepted runtime strings via JitMbCase. Wire
assertEncodingArgv (Argument #3) like the #34858 peer wave.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 26, 2026
Encoding still required a compile-time literal while peers (mb_strwidth /
mb_convert_case TITLE) already accept runtime strings. Wire
assertEncodingArgv (Argument #3) like the #34884 peer wave.

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 26, 2026
…#35157)

Encoding still required a compile-time literal while peers (mb_strwidth /
mb_convert_case TITLE) already accept runtime strings. Wire
assertEncodingArgv (Argument #3) like the #34884 peer wave.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Aug 29, 2026
…). (#35712)

JitMbStrcut missed isNullConstant on argument #3, so mb_strcut($s, -N, null)
hit JitStrictIntArg and threw TypeError while peer JitMbSubstr already mapped
null to the -1 omit-length sentinel. Add repro + MbNegativeOffsetNullLengthAotTest.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant