FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=16674&edit=1

ID: 16674
Updated by: schmidt@php.net
Reported By: borz_off at cs dot msu dot su
Summary: Options are ignored for already added query variables
Status: Open
Type: Bug
Package: Net_URL2
Operating System: Irrelevant
Package Version: 0.3.0
PHP Version: Irrelevant
Roadmap Versions:
New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2009-10-03 10:42:16] avb

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(
'http://pear.php.net/bugs/search.php',
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:
----------------
http://pear.php.net/bugs/search.php?package_name[0]=Net_URL2&status=Open&cmd=display

Actual result:
--------------
http://pear.php.net/bugs/search.php?package_name=Net_URL2&status=Open&cmd=display

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

Search Discussions

  • Borz_off at Oct 5, 2009 at 6:10 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16674&edit=1

    ID: 16674
    Updated by: borz_off@cs.msu.su
    Reported By: borz_off at cs dot msu dot su
    Summary: Options are ignored for already added query variables
    Status: Open
    Type: Bug
    Package: Net_URL2
    Operating System: Irrelevant
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    OK, here is a more believable example:

    ----------------
    require_once 'Net/URL2.php';

    $url = new Net_URL2('http://www.example.com/');

    $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]?


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-10-05 19:50:22] 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-03 10:42:16] avb

    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(
    'http://pear.php.net/bugs/search.php',
    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:
    ----------------
    http://pear.php.net/bugs/search.php?package_name[0]=Net_URL2&status=Open&cmd=display

    Actual result:
    --------------
    http://pear.php.net/bugs/search.php?package_name=Net_URL2&status=Open&cmd=display

    ------------------------------------------------------------------------
  • Schmidt at Oct 25, 2009 at 11:21 am
    Edit report at http://pear.php.net/bugs/bug.php?id=16674&edit=1

    ID: 16674
    Updated by: schmidt@php.net
    Reported By: borz_off at cs dot msu dot su
    Summary: Options are ignored for already added query variables
    Status: Open
    Type: Bug
    Package: Net_URL2
    Operating System: Irrelevant
    Package Version: 0.3.0
    PHP Version: Irrelevant
    Roadmap Versions:
    New Comment:

    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.


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-10-05 20:10:30] avb

    OK, here is a more believable example:

    ----------------
    require_once 'Net/URL2.php';

    $url = new Net_URL2('http://www.example.com/');

    $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-05 19:50:22] 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-03 10:42:16] avb

    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(
    'http://pear.php.net/bugs/search.php',
    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:
    ----------------
    http://pear.php.net/bugs/search.php?package_name[0]=Net_URL2&status=Open&cmd=display

    Actual result:
    --------------
    http://pear.php.net/bugs/search.php?package_name=Net_URL2&status=Open&cmd=display

    ------------------------------------------------------------------------
  • Schmidt at Oct 28, 2009 at 7:53 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=16674&edit=1

    ID: 16674
    Updated by: schmidt@php.net
    Reported By: borz_off at cs dot msu dot su
    Summary: Options are ignored for already added query variables
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: Net_URL2
    Operating System: Irrelevant
    Package Version: 0.3.0
    PHP Version: Irrelevant
    -Assigned To:
    +Assigned To: schmidt
    Roadmap Versions:
    New Comment:

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: schmidt
    setOption() is now gone.

    http://news.php.net/php.pear.cvs/57942


    Previous Comments:
    ------------------------------------------------------------------------

    [2009-10-25 12:20:49] 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-05 20:10:30] avb

    OK, here is a more believable example:

    ----------------
    require_once 'Net/URL2.php';

    $url = new Net_URL2('http://www.example.com/');

    $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-05 19:50:22] 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-03 10:42:16] avb

    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(
    'http://pear.php.net/bugs/search.php',
    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:
    ----------------
    http://pear.php.net/bugs/search.php?package_name[0]=Net_URL2&status=Open&cmd=display

    Actual result:
    --------------
    http://pear.php.net/bugs/search.php?package_name=Net_URL2&status=Open&cmd=display

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 5, '09 at 5:50p
activeOct 28, '09 at 7:53p
posts4
users2
websitepear.php.net

2 users in discussion

Schmidt: 3 posts Borz_off: 1 post

People

Translate

site design / logo © 2022 Grokbase