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
I'm getting the following notice whenever the main shortening service is not available (and the fallback one needs to be used):
Notice: Undefined variable: url in shorten_url() (line 149 of /mnt/www/html/eluniversodev/docroot/sites/all/modules/shorten/shorten.module).
Proposed resolution
The $url variable should be initialized to a default value at the beginning of the shorten_url function:
function shorten_url($original = '', $service = '') {
$url = '';
Comments
Comment #1
IceCreamYou CreditAttribution: IceCreamYou commentedCommitted fix to dev: 7.x, 6.x
The reason that fix should work is that
trim()
coerces input to a string without complaining.