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('arg_separator.xxx')
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)    
Subscription  


 [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('http://foo.bar/index.php'); $url->addQueryString('apples', 5); $url->addQueryString('oranges', 15); echo $url->getURL(); die; ?> Expected result: ---------------- The output of the $url->getURL() call should be: http://foo.bar/index.php?apples=5&oranges=15 Actual result: -------------- The output of the $url->getURL() call is: http://foo.bar/index.php?apples=5&oranges=15

Comments

 [2004-04-23 00:40 UTC] dufuz
Would be really great to get this feature :) Specially since we use this on pear.php.net 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 http://pear.php.net/packages.php
 [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().