medialize / medialize/URI.js

.query() Array-Parameters won't fill PHP's $_GET as intended

Open
#28 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

QueryString Requires More Interest
Dominant language
JavaScript
Stars
6.2k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

Current Version

This Code:

.query({ foo: "bar", hello: ["world", "mars"] });

Leads to this:

// -> http://example.com/bar/foo.xml?foo=bar&hello=world&hello=mars

I think that's kinda senseless. Cause this is what we see on the Server-Side:

$_GET = array(
  'foo' => 'bar',
  'hello' => 'mars'
);

I.e. "hello=world" is missing and no one can work with it.

Improved Version

Better:

// -> http://example.com/bar/foo.xml?foo=bar&hello[]=world&hello[]=mars

Results in this:

$_GET = array(
  'foo' => 'bar',
  'hello' => array(
    0 => 'world',
    1 => 'mars'
  )
);

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 at the .query() entry point and reproduce the array-parameter example from the issue. Trace how array values become the query string, then verify the result against PHP's $_GET parsing. Done means repeated array parameters use bracket notation so both values are preserved server-side.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
backend, web-dev
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.