For some reason the call to Drupal\Core\Url::fromUri() is not very fault tolerant and fails with a fatal error

The website encountered an unexpected error. Please try again later.InvalidArgumentException: The URI 'tel:911' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 281 of core/lib/Drupal/Core/Url.php).

If the block is displayed on node edit, it prevents fixing the content. This needs to be more fault tolerant such that a failure of link lookup does not prevent all access to the page.

Comments

swirt created an issue. See original summary.

  • swirt committed bb5e34a on 8.x-1.x
    Issue #3106643: Make link check fault tolerant
    
swirt’s picture

Status: Active » Fixed

I added a check for a specific php bug with parse_url().

 Feeding it the following and then trying to get the scheme as 'tel' results in:
tel:+18008271000  -> fine
tel: +18008271000 -> fine
tel:18008271000   -> fine
tel: 18008271000  -> fine
tel: 911                  -> fine
tel:+911                -> fine
tel: +911               -> fine
tel:911                  -> FAIL

https://bugs.php.net/bug.php?id=70588

I also placed some of the logic within a try catch to offer some minimal protection against errors.

There are still some risks, but this is better.

swirt’s picture

Status: Fixed » Closed (fixed)