WordPress / WordPress/Requests

IRI code urlencodes get parameters

Open
#274 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core
Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

By default the url for get requests get pushed through the IRI parser/seraliser/normaliser. That class passes the query parameters through the replace_invalid_with_pct_encoding function which replaces [ and ] with %5B and %5D.

This makes PHP not recognize it as an array anymore and breaks my API calls.

For example the original url:

http://example.com/?test[a]=1&test[b]=2

Becomes the following in PHP:

$_GET['test']['a'] = 1;
$_GET['test']['b'] = 2;

but with the IRI rewrite it becomes:

$_GET['test%5Ba%5D'] = 1;
$_GET['test%5Bb%5D'] = 2;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing GET request URLs through the IRI parser, serializer, and normalizer, especially replace_invalid_with_pct_encoding. Reproduce the example with bracketed query parameters and inspect the existing URL or IRI tests. Done means the request preserves the PHP-style array parameters while retaining correct handling of other invalid query characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.