[PEAR-BUG] Bug #20421 [Opn->Fbk]: Reject invalid path
[email protected] Wed, 8 Oct 2014 00:15:23 +0100 (BST)
| Newsgroups | php.pear.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://pear.php.net/bugs/bug.php?id=20421&edit=1 ID: 20421 Updated by: [email protected] Reported By: jan dot prachar at gmail dot com Summary: Reject invalid path -Status: Open +Status: Feedback Type: Bug Package: Net_URL2 Package Version: 2.0.7 PHP Version: Irrelevant -Assigned To: +Assigned To: tkli Roadmap Versions: New Comment: -Status: Open +Status: Feedback -Assigned To: +Assigned To: tkli what you write is correct in terms of RFC 3986 but unfortunately Net_URL2 is not about URI validation (in full or in part). therefore throwing an exception while calling Net_URL2::setPath() (or Net_URL2::getUrl() and those by yours correctly named authority counterparts) could be (at least) unexpected or just straight forward introduce a new feature. if you share more about your motivation, it might be possible to find a beautiful way to keep Net_URL2 open for extension but closed for modification offering good options for your validation needs. me seeing more context would also allow me to better understand why you qualified this as a bug. feedback welcome. -- tk Previous Comments: ------------------------------------------------------------------------ [2014-10-03 00:01:42] pracj3am As well as when you set path first and then add/remove authority. ------------------------------------------------------------------------ [2014-10-02 23:56:49] pracj3am Description: ------------ See https://tools.ietf.org/html/rfc3986#section-3.3 Path should be empty or begin with slash if authority is present. If a URI does not contain an authority component, then the path cannot begin with two slash characters. Test script: --------------- $url = new Net_URL2('http:g'); $url->setPath('//h'); echo $url->getUrl(); Expected result: ---------------- *exception thrown* Actual result: -------------- http://h ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=20421&edit=1