Skip to content

Fix query_form regression for undef/valueless params (GH#133)#181

Draft
oalders wants to merge 1 commit into
masterfrom
fix-133
Draft

Fix query_form regression for undef/valueless params (GH#133)#181
oalders wants to merge 1 commit into
masterfrom
fix-133

Conversation

@oalders

@oalders oalders commented Jun 15, 2026

Copy link
Copy Markdown
Member

Closes #133

Problem

URI 5.19 (GH#65, commit 9ee8098) changed query_form so that:

  • encoding an undef value produced a bare key with no =, and
  • parsing a param with no = decoded to undef.

This broke downstream code such as HTTP::Request::Common (which passes undef to mean an empty value) and diverged from the WHATWG URL spec, where a param with no = decodes to an empty string. Maintainers in the issue thread confirmed the pre-5.19 behavior was correct.

Changes

  • Restore pre-5.19 behavior in lib/URI/_query.pm: an undef value encodes as key=, and a param with no = decodes to an empty string rather than undef.
  • Update existing assertions in t/query.t and t/old-base.t to expect the restored behavior.
  • Add regression tests covering scalar undef, undef among multiple values, undef in a hash, and empty-string round-tripping.
  • Add a Changes entry.

Testing

  • Full suite passes: prove -lr t/ -> 1037 tests, 0 failures.
  • Red-green verified: the new regression tests fail against the pre-fix source and pass with the fix.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.09%. Comparing base (e5edc02) to head (59103fe).

Files with missing lines Patch % Lines
lib/URI/_query.pm 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #181      +/-   ##
==========================================
- Coverage   87.09%   87.09%   -0.01%     
==========================================
  Files          64       64              
  Lines        2093     2092       -1     
  Branches      512      511       -1     
==========================================
- Hits         1823     1822       -1     
  Misses        109      109              
  Partials      161      161              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

URI 5.19 (GH#65) changed query_form so an undef value encoded as a bare
"key" (no "="), and a param parsed without "=" decoded to undef. This
broke downstream code such as HTTP::Request::Common, which passes undef
to mean an empty value, and diverged from the WHATWG URL spec (a param
with no "=" decodes to an empty string).

Restore the pre-5.19 behavior:
- encoding an undef value emits "key="
- a param with no "=" decodes to an empty string, not undef

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

URI 5.19 breaks Catalyst-Controller-DBIC-API

1 participant