Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.15

Bug #704 Hardcoded & instead of ini_get('')
Submitted: 2004-02-07 14:51 UTC
From: miancule at yahoo dot com Assigned: richard
Status: Closed Package: Net_URL
PHP Version: 4.3.4 OS: Windows XP
Roadmaps: (Not assigned)    

 [2004-02-07 14:51 UTC] miancule at yahoo dot com
Description: ------------ A small thing, but essential for XHTML compliancy (& instead of & in URLs), etc Instead of using harcoded & as argument separator, the code should use ini_get('arg_separator.input') and ini_get('arg_separator.output'). Changes to URL.php: Line 272: $querystring = implode('&', $querystring); becomes: $querystring = implode(ini_get('arg_separator.output'), $querystring); Line 289: $parts = preg_split('/&/', $querystring, -1, PREG_SPLIT_NO_EMPTY); becomes: $parts = preg_split('/'.preg_quote(ini_get('arg_separator.input'),'/').'/', $querystring, -1, PREG_SPLIT_NO_EMPTY); Regards, mihai Reproduce code: --------------- <?php ini_set('arg_separator.output', '&'); require_once 'Net/URL.php'; $url = &new NetURL(''); $url->addQueryString('apples', 5); $url->addQueryString('oranges', 15); echo $url->getURL(); die; ?> Expected result: ---------------- The output of the $url->getURL() call should be: Actual result: -------------- The output of the $url->getURL() call is:


 [2004-04-23 00:40 UTC] dufuz
Would be really great to get this feature :) Specially since we use this on and I'm trying to make the site XHTML valid ... and this is kinda stone in my path ;) i.e. net_url making urls not valid ;/ Helgi
 [2004-05-08 17:32 UTC] richard at phpguru dot org
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at
 [2004-07-12 16:12 UTC] ths
Looks like this fix broke HTTP_Request, because the (X)HTMLlized URL ist not valid for Requests. In my humble opinion there there should a toHtml() method to address these (X)HTML compliancy stuff.
 [2004-09-02 21:27 UTC] joern_h at gmx dot net
I think the value of arg_separator.output should not be used since its a setting that applies to the server the script is running on. If you connect to a different server it may need a different separator. Perhaps the separator should be settable by a method and default to '&'.
 [2005-03-07 04:20 UTC] dufuz
Joern: AFAIK then arg_separator.output|input isn't gotten from the remote server :-) Would be kinda silly anyway, so it's locally the output one you can set via ini_set the input one you have to modify php.ini, httpd.conf or use .htaccess Richard: Would be maybe better to add a third option (array then) which would include input and output separators and just default to & array('input' => '&', 'output' => '$'); Something in that direction. Not everyone can use .htaccess
 [2005-03-07 14:17 UTC] richard
Everyone can however use ini_set().