From:  pear-qa@lists.php.net ("qdinar@gmail.com")
Date:  27 Aug 2016 22:22:34 Hong Kong Time
Newsgroup:  news.php.net/php.pear.bugs
Subject:  

[PEAR-BUG] Bug #21013 [Com]: problem with two dots without trailing slash

NNTP-Posting-Host:  null

Edit report at https://pear.php.net/bugs/bug.php?id=21013&edit=1

 ID:               21013
 Comment by:       qdinar@gmail.com
 Reported By:      qdinar at gmail dot com
 Summary:          problem with two dots without trailing slash
 Status:           Bogus
 Type:             Bug
 Package:          Net_URL2
 Operating System: windows 10
 Package Version:  Unknown
 PHP Version:      5.5.11
 Assigned To:      tkli
 Roadmap Versions: 
 New Comment:

"The point you're missing is to normalize the base URI first, then
you'll get the result you expect."
- my point is ok: base uri has not to be normalized, that
(normalization) is optional, see RFC 3986 5.2.1 .

"The important part here is that the base-URIs path component is already
normalized (See RFC 3986, sections section 5.2.4 and 6)."
- RFC 3986 sections 5.2.4 and 6 do not say that base uri must be
normalized.

"The expected result you present is not RFC conform resolution of an URI
to a base URI."
"For the merging of paths in resolve(), please see section 5.2.3."
- there is a error in 5.2.3 after "otherwise": author(s) have just
forgotten about case with ".." at end of path or author(s) just speak
shortly like if the base url is normalized. in the case with ".." at end
of path, " excluding any characters after the right-most "/" " is not
correct algorithm. (most easy way to fix it in that case is to append
"/" to it and only then append reference's path to it).

"Example: ...  $base->normalize(); "
- if normalisation was required for base uri, by rfc, this
"base->normalize" would not expected to be used by programmer (user of
Net_URL2) (as you show in the example), but it would be done inside
"base->resolve" by programmers of Net_URL2.


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

[2016-01-06 19:10:18] tkli

-Status: Assigned
+Status: Bogus
Behaviour is not unexpected.

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

[2016-01-06 19:08:32] tkli

I can reproduce your report against the current stable version but this
is not a bug.

The expected result you present is not RFC conform resolution of an URI
to a base URI.

The point you're missing is to normalize the base URI first, then you'll
get the result you expect.

Example:

    $base = new Net_URL2('http://example.com/a/b/..');
    $base->normalize();
    var_dump((string)  (string) $base->resolve('c.php'));
    # string(26) "http://example.com/a/c.php"

The important part here is that the base-URIs path component is already
normalized (See RFC 3986, sections  section 5.2.4 and 6). For the
merging of paths in resolve(), please see  section 5.2.3.

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

[2016-01-04 03:53:26] tkli

Thank you for your feedback. I don't know which package version "CVS:
$Id: URL2.php 309223 2011-03-14 14:26:32Z till $" relates to. Can you
provide the *package version*? It is the package version I'm looking
for.

Despite it missing, I can see from the time-stamp that you have an
outdated version. Can you run your scenario with the latest version and
report back if it behaves the same?

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

[2016-01-04 03:06:44] qdinar

CVS: $Id: URL2.php 309223 2011-03-14 14:26:32Z till $

the ? signs in the report appeared instead of russian letter f

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

[2016-01-03 10:26:34] tkli

-Assigned To:
+Assigned To: tkli
Thanks for reporting this issue, could you share which version of
Net_URL2 you're using?

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=21013

-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=21013&edit=1