Blogs Engineering

Fixing Empty Teaser Titles in Sulu 3 for Content Migrated From Sulu 2

Sulu teasers showed no title when the excerpt title was an empty string. The merged fix falls back to the page or article title in that case too.

PHPsulu/suluCMSSymfonycontent migration

The difference between null and '', in a CMS teaser.

Short answer

Sulu's page and article teaser providers fell back to the content title only when the excerpt title was missing (null). Content migrated from Sulu 2 stores an unset excerpt title as an empty string, so those teasers ended up with no title. It showed most on pages turned into internal links, whose teaser uses the link target's excerpt. The fix treats an empty string the same as a missing value. It was merged as PR #9039 and closed issue #8766.

The problem

Sulu is a Symfony-based content management system. Issue #8766, on Sulu 3.0.x, reported that a teaser_selection returned empty data for pages later changed into internal links, and pointed at PageTeaserProvider::resolveTitle.

Root cause

The ?? operator only catches null:

$title = $dimensionContent->getExcerptTitle() ?? $dimensionContent->getTitle();

An empty string passed straight through, and the method then returned null for the empty title. As the PR description notes, both providers already treated an empty description and an empty "more" text this way; the title was the odd one out.

The fix

The same change in PageTeaserProvider and ArticleTeaserProvider:

$excerptTitle = $dimensionContent->getExcerptTitle();
$title = '' !== ($excerptTitle ?? '') ? $excerptTitle : $dimensionContent->getTitle();

Three functional tests cover it: an empty excerpt title on a page, on an article, and an internal link to a page whose excerpt title is empty.

By the numbers

  • Repository: sulu/sulu, 1,363 stars (Nov 3, 2026), PHP, MIT
  • Files changed: 4
  • Lines: +87 / -2
  • Commits: 1
  • Opened: Aug 21, 2026. Merged: Sep 22, 2026. Time to merge: 31 days, 14 hours
  • Review: approved and merged by a maintainer

How the review went

A maintainer approved and merged it, replying "thank you! :)".

FAQ

Do I need to re-save migrated content?

No. The fallback happens when the teaser is resolved.

Where can I read more?

See the pull request and the original issue.

The goal

Migrations leave data in shapes the new code didn't expect. Treating "empty" and "missing" the same where they mean the same keeps migrated sites looking right.

Run the loop

Turn production signals into reviewed fixes.

Start a free trial and see how Prilog maps real incidents to code-level pull requests.