When a user visit the terms of user page and accept the terms, eventually they get the error:

NOTICE: PHP message: Uncaught PHP Exception InvalidArgumentException: "The user-entered string '' must begin with a '/', '?', or '#'." at /var/www/html/web/core/lib/Drupal/Core/Url.php line 204

Comments

rfsbsb created an issue. See original summary.

rfsbsb’s picture

StatusFileSize
new542 bytes

Patch attached

rfsbsb’s picture

Version: 8.x-2.x-dev » 8.x-2.0-alpha1
mradcliffe’s picture

Version: 8.x-2.0-alpha1 » 8.x-2.x-dev
Status: Active » Needs review

Thank you for contributing a patch, @rfsbsb.

We should set the issue to Needs Review and keep the Version at the latest dev release so that the patch is run through automated tests. I set these to see how the patch goes.

I see the issue, but would you be able to provide a few more steps to reproduce and add those to the issue summary, @rfsbsb?

Also, it may also be good to set the defaults to '/' in the default agreement as well as in getSettings on the Agreement entity, but there will be a merge conflict with #2991481: Excess PHP notices as well.

rfsbsb’s picture

Hi @mradcliffe,

Thanks for clarifying about the version. I've actually tested this patch against both alpha1 and -dev and it applied to both.

As for the steps to reproduce:

  • Create a user as admin
  • Log in with this user and accept the terms upon login
  • Once logged in as this new user access access one of the terms of agreement created
  • Accept the terms and submit the form
  • This will send the noticed on issue description

This is because somehow the user does not get a proper destination URL, causing the URL formation invalid.

mradcliffe’s picture

Priority: Normal » Major
StatusFileSize
new3.69 KB
new5.51 KB
new6.04 KB

Thank you!

I found the bug in the tests where I believe I worked around this bug. I also realized my question in #5 about not setting blank anymore didn't make sense after I re-read current expected behavior.

Here's an updated patch that fixes the test (and some code standard cleanups). The testonly patch should fail with the error in the summary, and the other patch will show that it passes.

The last submitted patch, 6: agreement-3026684-fix-exception-testonly-6.patch, failed testing. View results

mradcliffe’s picture

  • mradcliffe committed 8f869cf on 8.x-2.x
    Issue #3026684 by rfsbsb, mradcliffe: Fixes exception with no...
mradcliffe’s picture

Status: Needs review » Fixed

Went ahead and committed and rolled a new tag.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.