Request->to('url') #19

Closed
litek opened this Issue Jul 2, 2011 · 5 comments

Projects

None yet

5 participants

@litek

Using IIS 7.5 on Windows7 with rewriting enabled.

While retrieving the request url via $params['request']->to('url') in a run filter to Dispatcher it throws a notice "Array to string conversion in libraries\lithium\util\String.php on line 245". By disabling notices, the returning url contains array in place of a query string.

This only occurs when the querystring is empty, thus sending an empty array as $options['query'] to \lithium\net\htttp\Request::to($format, $options).

Line 163 makes sure $options['query'] is a string, but only if it's non-empty.

if ($options['query'] && is_array($options['query'])) {
    $options['query'] = $this->queryString($options['query']);
}

Removing the first condition resolved my problem.

@daschl
Union of RAD member

hi litek,

thanks for your ticket. can you provide a short test-case or url example that we can reproduce? Thanks again!

@nateabele
Union of RAD member

@daschl If the submitter is not able to provide a test case, could you work with @Ciaro to produce one? Thanks!

@daschl
Union of RAD member

@nateabele of course, let's see what we can do. If we come up with something, I think it would be a good idea to push it into the windows branch.

@litek

Apologies for the late reply, I just got back from a short vacation.

Added a sample test case here: litek/lithium@a9622fc
Currently fails with expected: 'http://foo.com/' result: 'http://foo.com/Array'

On a side note, also two other tests fail:
Assertion 'assertEqual' failed in lithium\tests\cases\action\RequestTest::testRemoteAddrFromHttpPcRemoteAddr() on line 128: expected: '123.456.789.000' result: '127.0.0.1'
Assertion 'assertEqual' failed in lithium\tests\cases\action\RequestTest::testType() on line 283: expected: 'html' result: ''

@Ciaro

testRemoteAddrFromHttpPcRemoteAddr() seems to fail on every setup I'm testing Lithium on (Zend Server for Windows, IIS on a Plesk 10 Server, Debian+Apache on Virtualbox).

@gwoo gwoo added a commit that referenced this issue Jul 20, 2011
@gwoo gwoo fixing issue #19 on github where passing an empty array for a value t…
…o String::insert() throws error.
c433ae9
@gwoo gwoo closed this Jul 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment