Skip to content

Stdlib: preg_match() float $offset coercion like Zend (#13818) - #13892

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-13818-preg-match-float-offset
Jun 30, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-13818-preg-match-float-offset

Conversation

@PurHur

@PurHur PurHur commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • preg_match() / preg_match_all() now coerce float $offset via VmMath::parseIntBuiltinArgForFrame (php-src Z_PARAM_LONG / ext/pcre/php_pcre.c).
  • JitLongArg truncates TYPE_NATIVE_DOUBLE with fpToSi for JIT/AOT offset lowering.

Closes #13818

Verification

./script/docker-exec.sh -- bash -lc '
  php test/repro/maintainer_gap_preg_match_float_offset.php
  php bin/vm.php test/repro/maintainer_gap_preg_match_float_offset.php
  php bin/compile.php -l test/repro/maintainer_gap_preg_match_float_offset.php
  ./vendor/bin/phpunit --filter preg_match_float_offset test/compliance/
'

Output:

2
2
warnings=2

PHPUnit (Docker): OK (2 tests, 2 assertions) — VM + Zend PHPT reference.

Made with Cursor

…).

Use VmMath::parseIntBuiltinArgForFrame for VM offset args and JitLongArg fpToSi for native double; compliance captures E_DEPRECATED via error handler.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit ce5c3be into master Jun 30, 2026
@PurHur
PurHur deleted the agent/issue-13818-preg-match-float-offset branch June 30, 2026 01:22
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.

Stdlib: preg_match()/preg_match_all() float $offset — LogicException not truncated int (ext/pcre/php_pcre.c)

1 participant