Skip to content

Stdlib: RoundingMode unit enum; drop phantom PHP_ROUND_* (#28535) - #28545

Merged
PurHur merged 1 commit into
masterfrom
fix/28535-roundingmode-unit-enum
Aug 7, 2026
Merged

Stdlib: RoundingMode unit enum; drop phantom PHP_ROUND_* (#28535)#28545
PurHur merged 1 commit into
masterfrom
fix/28535-roundingmode-unit-enum

Conversation

@PurHur

@PurHur PurHur commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Register RoundingMode as a unit enum (VM + JIT), not int-backed.
  • Stop exporting phantom PHP_ROUND_CEILING / FLOOR / TOWARD_ZERO / AWAY_FROM_ZERO via defined() / ConstFetch (legacy Half* ints 1–4 remain).
  • Reflection: round() $mode is RoundingMode|int with default RoundingMode::HalfAwayFromZero (constant name exposed).

Closes #28535

php-src reference

  • ext/standard/basic_functions.stub.phpenum RoundingMode
  • PHP: ext/standard/BuiltinEnums.php, StdlibConstants.php, BuiltinInternalArgInfo / DefaultValues, JIT Object_.php

Test plan

  • PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_28535_roundingmode_unit_enum.php
  • Compliance stdlib/rounding_mode_unit_enum_28535 EXPECT match
  • Existing rounding_mode_enum still green

Sibling behavioral wrong-output on negatives: #28534 (next).

Made with Cursor

Match php-src: RoundingMode is not int-backed; PHP_ROUND_CEILING/FLOOR/TOWARD_ZERO/AWAY_FROM_ZERO stay undefined; round() Reflection $mode is RoundingMode|int defaulting to HalfAwayFromZero.

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.

Regression: RoundingMode int-backed + PHP_ROUND_CEILING/FLOOR/TOWARD_ZERO/AWAY phantoms — Zend unit enum (re-#16875, ext/standard/math.c)

1 participant