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

Bug #16674 Options are ignored for already added query variables
Submitted: 2009-10-03 14:42 UTC
From: avb Assigned: schmidt
Status: Closed Package: Net_URL2 (version 0.3.0)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    

 [2009-10-03 14:42 UTC] avb (Alexey Borzov)
Description: ------------ Trying to set 'use_brackets' options (probably others, too) on object containing already added query variables has no effect on output. This makes it a bit difficult to e.g. propagate 'use_brackets' option from HTTP_Request2 to Net_URL2. Test script: --------------- require_once 'Net/URL2.php'; $url = new Net_URL2( '', array(Net_URL2::OPTION_USE_BRACKETS => false) ); $url->setQueryVariables(array( 'package_name' => array('Net_URL2'), 'status' => 'Open', 'cmd' => 'display' )); $url->setOption(Net_URL2::OPTION_USE_BRACKETS, true); echo $url; Expected result: ----------------[0]=Net_URL2&status=Open&cmd=display Actual result: --------------


 [2009-10-05 23:50 UTC] schmidt (Christian Schmidt)
Why are you passing Net_URL2::OPTION_USE_BRACKETS => false to the constructor? The option should be set to the proper value before setQueryVariables() is called.
 [2009-10-06 00:10 UTC] avb (Alexey Borzov)
OK, here is a more believable example: ---------------- require_once 'Net/URL2.php'; $url = new Net_URL2(''); $url->setQueryVariables(array( 'param_first' => 'foo', 'param_second' => 'bar' )); $url->setOption(Net_URL2::OPTION_SEPARATOR_OUTPUT, ';'); echo $url; ---------------- is it documented anywhere that setOption() should be called before calls to setQueryVariable[s]?
 [2009-10-25 16:20 UTC] schmidt (Christian Schmidt)
I think I'll just remove setOption(), i.e. the user must provide all options in the constructor when the URL to be parsed is provided.
 [2009-10-29 00:53 UTC] schmidt (Christian Schmidt)
-Status: Open +Status: Closed -Assigned To: +Assigned To: schmidt
setOption() is now gone.