php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73270 php.ini says wrong default settings for arg_separator.output
Submitted: 2016-10-09 11:54 UTC Modified: 2016-11-29 08:43 UTC
From: labs at undef dot name Assigned: peehaa (profile)
Status: Closed Package: Documentation problem
PHP Version: 7.0.11 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: labs at undef dot name
New email:
PHP Version: OS:

 

 [2016-10-09 11:54 UTC] labs at undef dot name
Description:
------------
---
From manual page: http://www.php.net/function.http-build-query
---
The php.ini file says:

; The separator used in PHP generated URLs to separate arguments.
; PHP's default setting is "&".
; http://php.net/arg-separator.output
; Example:
;arg_separator.output = "&"

So "&" should the default setting, but the result of http_build_query() is with "&".


$data = array(
	'secret'	=> 'value_secret',
	'response'	=> 'value_response',
);

echo http_build_query($data) ."\n";
Results into "secret=value_secret&response=value_response"

echo http_build_query($data, null, '&') ."\n";
Results into "secret=value_secret&response=value_response".


Also the phpinfo() function output for "arg_separator.output" is "&" but is displayed in the generated HTML-Page as simple "&" which is confusing.

This is also at the default php.ini settings at "arg_separator.input".


--------

If i set "arg_separator.output" to "&" or '&' in the php.ini, then i also get "&" with http_build_query().

ini_get('arg_separator.output') also returns "&" then.


Test script:
---------------
$data = array(
	'secret'	=> 'value_secret',
	'response'	=> 'value_response',
);
echo ini_get('arg_separator.output') ."\n";
echo http_build_query($data) ."\n";
echo http_build_query($data, null, '&') ."\n";



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-28 18:51 UTC] peehaa@php.net
-Assigned To: +Assigned To: peehaa
 [2016-11-28 18:59 UTC] peehaa@php.net
-Status: Assigned +Status: Feedback
 [2016-11-28 18:59 UTC] peehaa@php.net
> So "&" should the default setting, but the result of http_build_query() is with "&".

I cannot reproduce this: https://3v4l.org/8JfYE

> If i set "arg_separator.output" to "&" or '&' in the php.ini, then i also get "&" with http_build_query().

> ini_get('arg_separator.output') also returns "&" then.

Again no repro: https://3v4l.org/gCrMb

I *do* expect the default value correctly in the ini files though so `arg_separator.output = "&"` instead of `arg_separator.output = "&"`.
 [2016-11-29 08:43 UTC] labs at undef dot name
-Status: Feedback +Status: Closed
 [2016-11-29 08:43 UTC] labs at undef dot name
No bug, it's a user fail. I re-tested it again and found this line in a included script:

ini_set('arg_separator.output', '&');

So it's my fault, sorry for the waste of time!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 16:02:26 2025 UTC