Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
See https://qa.drupal.org/pifr/test/883523
* Drupal\views_ui\Tests\DisplayPathTest (97 pass(es), 2 fail(s), and 0 exception(s))
- [fail] [Fatal error] "[09-Oct-2014 12:26:18 UTC] Uncaught PHP Exception InvalidArgumentException: "The URI "base://(:;2&+h^" is invalid. You must use a valid URI scheme. Use base:// for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal." at /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Url.php line 207
" in Unknown on line 0 of Unknown.
- [fail] [Fatal error] "[09-Oct-2014 12:26:18 UTC] Uncaught PHP Exception InvalidArgumentException: "The URI "base://(:;2&+h^" is invalid. You must use a valid URI scheme. Use base:// for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal." at /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Url.php line 207
" in Unknown on line 0 of Unknown.
Proposed resolution
- Don't allow ? as part of the path
- Don't allow an empty path but a query
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff.txt | 633 bytes | dawehner |
#22 | 2353347-22.patch | 2.01 KB | dawehner |
#18 | interdiff.txt | 645 bytes | dawehner |
#18 | 2353347-18.patch | 2.03 KB | dawehner |
#16 | 2353347-16.patch | 1.95 KB | dawehner |
Comments
Comment #1
dawehnerThere we go.
Comment #2
dawehnerLet's use a better variable name.
Comment #3
catchComment #4
xjmMarked #2353457: Random test failure in Drupal\views_ui\Tests\DisplayPathTest duplicate.
Comment #5
Wim LeersOnly nitpicks:
I think I know why this uses
UrlHelper::parse()
rather thanparse_url()
, but shouldn't we document that very briefly?s/path query/query/
?
s/empty just fragment/only fragment/
s/a path/an invalid path/
s/valid/random, valid/
Comment #6
zaporylieRe-roll and fixed 2-5 from #5
Comment #8
zaporylieI missed one string. Should be ok this time.
Comment #9
zaporylieComment #10
dawehnerWell, there has been no special reason, just general usage, as I assumed that there is a good reason why Drupal has introduced its own wrapper for it.
Comment #11
dawehnerBtw. I am not convinced that this belongs into views_ui, given that the code is part of views itself.
Comment #12
chx CreditAttribution: chx commentedI saw this error myself. The fix is good, Wim's concerns are addressed and UrlHelper::parse supports internal urls vs parse_url doesn't, I doubt we need to add this to every place where we call it.
Comment #13
alexpottCommitted 557bd08 and pushed to 8.0.x. Thanks!
Comment #15
alexpottJust had an issue fail with the above problem - we've not quite fixed this one :(
Comment #16
dawehnerWell yeah, the "@" is also a problem. I would vote for now, let's generate a safe string and add another custom test string to check for those cases.
Comment #17
penyaskitoWhy is it invalid? Could we hint what is wrong to the user here?
Comment #18
dawehnerMaybe link to the spec?
Comment #19
penyaskitowow, maybe too much?
Can we explicitly say the reserved chars (2.2. Reserved Characters) in that spec?
Comment #20
alexpottAlso an error message that is
Invalid path, see Spec
is very odd - no full stop. Personally I feelThe path '@path' is invalid.
is consistent with our other messages - for example the site front page and MenuLinkContentForm use a similar error message.Comment #21
YesCT CreditAttribution: YesCT commentedhad one here too
#2341341-41: Change public 'name' property access on languages to getName() and add back setName()
base://>j*>&:}A
Comment #22
dawehnerMaybe just that.
Comment #23
penyaskitoOK for me.
Comment #24
webchickGood catch.
Committed and pushed to 8.0.x. Thanks!