Skip to content

fix: reject an argument of the wrong type with a TypeError - #820

Merged
ptondereau merged 2 commits into
masterfrom
fix/option-rejects-wrong-type
Oct 15, 2026
Merged

ptondereau merged 2 commits into
masterfrom
fix/option-rejects-wrong-type

Conversation

@ptondereau

Copy link
Copy Markdown
Member

Description

Option<T>, typed variadics and Option<&mut ZendHashTable> turned a value of the wrong type into None or dropped it, and a failed argument conversion threw a plain Exception. They now throw a TypeError like ZPP, f32/f64 accept an int like a PHP float parameter (zend_parse_arg_double_slow), and mago goes to 1.57.0.

Fixes #819

Checklist

@codspeed

codspeed Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 51 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 51 untouched benchmarks


Comparing fix/option-rejects-wrong-type (07f4f73) with master (ff909ac)

Open in CodSpeed

@coveralls

coveralls commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38766232070

Coverage increased (+0.2%) to 75.503%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 5 uncovered changes across 3 files (68 of 73 lines covered, 93.15%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/types/mod.rs 11 8 72.73%
src/closure.rs 1 0 0.0%
src/types/array/mod.rs 3 2 66.67%
Total (7 files) 73 68 93.15%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
crates/introspection/src/stub.rs 1 88.46%

Coverage Stats

Coverage Status
Relevant Lines: 15100
Covered Lines: 11401
Line Coverage: 75.5%
Coverage Strength: 53.81 hits per line

💛 - Coveralls

@ptondereau
ptondereau marked this pull request as ready for review October 15, 2026 16:27
@ptondereau
ptondereau merged commit 7d00750 into master Oct 15, 2026
76 checks passed
@ptondereau
ptondereau deleted the fix/option-rejects-wrong-type branch October 15, 2026 16:39
@ext-php-rs-release ext-php-rs-release Bot mentioned this pull request Oct 15, 2026
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.

Option<T> parameters read a value of the wrong type as None

2 participants