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
\Drupal\aggregator\Entity\Item::getLink()
says it returns strings but it can return a NULL.
Steps to reproduce
Run Drupal\Tests\aggregator\Functional\AggregatorDisplayConfigurableTest
on PHP 8.1
Proposed resolution
Return an empty string instead of a NULL.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#7 | 3240148-7.patch | 452 bytes | alexpott |
#7 | 3-7-interdiff.txt | 465 bytes | alexpott |
#3 | 3240148-2.patch | 511 bytes | alexpott |
Comments
Comment #2
alexpottHere's the fix from the meta. The deprecation occurs due to template_preprocess_aggregator_item()
Comment #3
alexpottComment #4
alexpottComment #5
larowlanComment #6
catchAggregator's on its way out of core, but could we have an issue for the @todo to link to?
Comment #7
alexpottI investigated whether or not we could replace the
$variables['url'] = UrlHelper::stripDangerousProtocols($item->getLink());
with$variables['url'] = $item->toUrl()->toSting();
. That didn't work because a NULL link value triggers an exception in$item->toUrl()
. I think the fix here is fine. Gonna remove the @todoComment #8
andypost++ no todo needed
Comment #9
andypostComment #10
larowlanI wonder if there's merit in a follow-up to make the link field required.
Committed c9ec5e4 and pushed to 9.3.x. Thanks!