This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
setUri() invalidates relative URI when setting default ports #36
Closed
Description
Hi,
when setting a relative URI /example
the Zend\Http\Client::setUri()
method adds a default port and so invalidates the URI resulting in isValidRelative() returning FALSE instead of TRUE.
<?php
require './vendor/autoload.php';
$relativeUri = '/example';
$client = new Zend\Http\Client($relativeUri);
$uri = new Zend\Uri\Http($relativeUri);
var_dump($client->getUri()->isValidRelative(), $uri->isValidRelative());
Expected output
boolean(true)
boolean(true)
Actual output
boolean(false)
boolean(true)
I don't know how to build a patch, but line 323 of Client.php
should be
if (! $this->getUri()->getPort() && $this->getUri()->isAbsolute()) {
instead of
if (! $this->getUri()->getPort()) {
Cheers
Metadata
Metadata
Assignees
Labels
No labels