Doc #73270 [Fbk->Csd]: php.ini says wrong default settings for arg_separator.output
| From: | labs at undef dot name | Date: | Tue, 29 Nov 2016 08:43:55 +0000 |
| Subject: | Doc #73270 [Fbk->Csd]: php.ini says wrong default settings for arg_separator.output | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14155@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73270&edit=1
ID: 73270
User updated by: labs at undef dot name
Reported by: labs at undef dot name
Summary: php.ini says wrong default settings for
arg_separator.output
-Status: Feedback
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Linux
PHP Version: 7.0.11
Assigned To: peehaa
Block user comment: N
Private report: N
New Comment:
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!
Previous Comments:
------------------------------------------------------------------------
[2016-11-28 18:59:34] 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-10-09 11:54:58] 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";
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73270&edit=1