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 Jun 29, 2026
…13744)

php-src accepts an integer encoding_type as argument #3 without an explicit
separator; RFC3986 raw encoding only applies in the 4-arg form.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jun 30, 2026
PurHur added a commit that referenced this pull request Jul 5, 2026
…16327)

compileCallArgSends emitted null-literal ARG_SEND before nameSlot was
registered, so fgetcsv($fp, separator: null) bound null to argument #2
($length) instead of #3 ($separator). Resolve callArgNameSlot up front
for all fast-path sends; add delimiter→separator alias for php-src 8.2.

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 Jul 7, 2026
…17204) (#17211)

When only the encoding_type named parameter is supplied, read arg #4 even if
arg_separator (#3) is omitted so RFC3986 encoding applies per Zend/php-src.

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 Jul 10, 2026
…15475, #17736) (#17741)

Prevent forcedSiblingSlot from overwriting a resolved trailing FirstClassCallable
callback slot so array_udiff(array_keys(), array_keys(), strcmp(...)) wires arg #3
correctly. Add compliance guard for Generator::next() on closed generators.

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 Jul 13, 2026
… (#18661)

Wire unpack('i', pack(...), E::A) so the nested pack EXEC_RETURN feeds
argument #2 and the hoisted enum feeds argument #3, matching Zend's
TypeError on the offset operand instead of misreporting argument #2.

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