note 74781 added to function.http-build-query
| From: | pinkgothic at gmail dot com | Date: | Fri, 27 Apr 2007 09:24:48 +0000 |
| Subject: | note 74781 added to function.http-build-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125910@lists.php.net to get a copy of this message | ||
Be careful if you're assuming that arg_separator defaults to "&".
For me, with my xampp installation and PHP 5.2.1, this was scary:
[php.ini]
; The separator used in PHP generated URLs to separate arguments.
; Default is "&".
arg_separator.output = "&"
... as it gave me a complete headache debugging something, as I expected the string length to be the
length of the string my browser was displaying. I was so certain arg_separator was "&"
because I'd never changed my php.ini that it took me seemingly forever to consider looking at
the source code.
D'oh.
This may seem irrelevant at first (and I realise my case is an unusual way of stumbling into this
issue), but since, if you run htmlspecialchars() over "&", the result will be
"&", DON'T expect a one- or two-parameter http_build_query() to return a
query you still have to run through htmlspecialchars().
I suggest using the third parameter to retain your sanity.
----
Server IP: 212.124.37.9
Probable Submitter: 84.46.119.45
----
Manual Page -- http://www.php.net/manual/en/function.http-build-query.php
Edit -- https://master.php.net/note/edit/74781
Del: integrated -- https://master.php.net/note/delete/74781/integrated
Del: useless -- https://master.php.net/note/delete/74781/useless
Del: bad code -- https://master.php.net/note/delete/74781/bad+code
Del: spam -- https://master.php.net/note/delete/74781/spam
Del: non-english -- https://master.php.net/note/delete/74781/non-english
Del: in docs -- https://master.php.net/note/delete/74781/in+docs
Del: other reasons-- https://master.php.net/note/delete/74781
Reject -- https://master.php.net/note/reject/74781
Search -- https://master.php.net/manage/user-notes.php