Bug #72617 [Com]: http_build_query http_build_query incorrectly converts a string

From: Date: Mon, 18 Jul 2016 19:00:40 +0000
Subject: Bug #72617 [Com]: http_build_query http_build_query incorrectly converts a string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202406@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72617&edit=1

 ID:                 72617
 Comment by:         htc dot tolya at gmail dot com
 Reported by:        htc dot tolya at gmail dot com
 Summary:            http_build_query http_build_query incorrectly
                     converts a string
 Status:             Feedback
 Type:               Bug
 Package:            *URL Functions
 Operating System:   ANY
 PHP Version:        Irrelevant
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

if (arg_separator.output = "& amp;") the correct transformation is present in the
address &
if (arg_separator.output = "&") conversion is not correct!
but this is not a recipe because the address used file_get_contents and similar functions, and
&amp does not work there


Previous Comments:
------------------------------------------------------------------------
[2016-07-18 18:45:52] cmb@php.net

Usually, this should work fine, see <https://3v4l.org/KS61j>.

What is the value of your ini setting of arg_separator.output[1]?
What is your locale?

[1] <http://php.net/manual/en/ini.core.php#ini.arg-separator.output>

------------------------------------------------------------------------
[2016-07-18 17:18:05] htc dot tolya at gmail dot com

Description:
------------
http_build_query incorrectly converts a string.

Example.

$url = 'http://site.com/action?';
$url .= http_build_query([
  'param1' => 10,
  'region' => 'en'
]);

P.S>Setting arg_separator (& amp) solves the problem, but this approach does not in all
cases.



Test script:
---------------
$url = 'http://site.com/action?';
$url .= http_build_query([
  'param1' => 10,
  'region' => 'en'
]);
echo $url;

Expected result:
----------------
http://site.com/action?param1=10&region=en

Actual result:
--------------
http://site.com/action?param1=10®ion=en


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=72617&edit=1


Thread (4 messages)

« previous php.bugs (#202406) next »