Skip to content

Stdlib: gate PHP_ROUND_CEILING/FLOOR/TOWARD_ZERO/AWAY_FROM_ZERO on profile ≥8.4 (#22785) - #22799

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-22785-php-round-profile-gate
Jul 24, 2026
Merged

Stdlib: gate PHP_ROUND_CEILING/FLOOR/TOWARD_ZERO/AWAY_FROM_ZERO on profile ≥8.4 (#22785)#22799
PurHur merged 1 commit into
masterfrom
agent/stdlib-22785-php-round-profile-gate

Conversation

@PurHur

@PurHur PurHur commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

php-src: ext/standard/php_math_round_mode.h, basic_functions.stub.php (RoundingMode / round modes, 8.4+).

Test plan

  • PHP_COMPILER_PROFILE=8.2 php bin/vm.php test/repro/issue_22785_php_round_mode_profile82.php → CEILING/FLOOR/… =0, HALF_UP=1
  • PHP_COMPILER_PROFILE=8.4 → all four defined; round(1.1, 0, PHP_ROUND_CEILING) === 2.0
  • AOT: bin/compile.php + run under PROFILE=8.2/8.4 for defined('PHP_ROUND_CEILING')
  • vendor/bin/phpunit --filter 'php_round_mode_constants|PhpRoundModeConstantsTest' → OK (9 tests)
  • php script/bootstrap-inventory.php --check → OK 6508/6508

Verification transcript

# PROFILE=8.2 VM
PHP_ROUND_HALF_UP=1
PHP_ROUND_CEILING=0
PHP_ROUND_FLOOR=0
PHP_ROUND_TOWARD_ZERO=0
PHP_ROUND_AWAY_FROM_ZERO=0

# PROFILE=8.4 VM
PHP_ROUND_CEILING=1 5 … round=2

# AOT
PROFILE=8.4: true / 5
PROFILE=8.2: false / true (HALF_UP)

# phpunit
OK (9 tests, 29 assertions)

Note: AOT fixtures assert defined() + constant values only — native round() AOT currently segfaults/miscompiles independently of this gate (pre-existing).

Made with Cursor

…ofile ≥8.4 (#22785)

Match Zend: these modes are PHP 8.4+ only. defined()/ConstFetch now use
StdlibConstants::coreIntByName() (same gate as RoundingMode / ARRAY_PAD_*),
so PROFILE=8.2 and the 8.4.0-dev reference harness leave them undefined while
internal VmRound still has the int values.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur

PurHur commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

Cleanup bot: deleted leftover remote branch agent/stdlib-22785-php-round-profile-gate (squash-merged here; issue #22785 closed; tip already on master).

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: PHP_ROUND_CEILING/FLOOR/TOWARD_ZERO/AWAY_FROM_ZERO defined on PROFILE=8.2 — Zend undef (re-#11730/#15083, ext/standard/math.c)

1 participant