Double Space Bug in CMS

Elements 3.1.1 (24668), CMS pages on a PHP 8 host

Dates on three of my CMS sites were being published like this:

6th October,&10b00-07:00; 2026

Cause

The Text component held this, with two spaces before the Y:

{{item.date_published|date("jS F,  Y")}}

When the page is published, Elements turns the double space into   . It does this inside the {{ }} braces as well as in ordinary text, so the server receives a different date format:

{{item.date_published|date("jS F,  Y")}}

If the collection uses Load More, you can see this converted line in the published page source, inside its <template>.

PHP then reads the letters of &nbsp; as date codes:

Character PHP reads it as Prints
& plain text &
n month number 10
b plain text b
s seconds 00
p offset from UTC (PHP 8) -07:00
; plain text ;

So October prints &10b00-07:00; and March prints &3b00-07:00;.

Steps to reproduce

  1. Add a CMS Collection and put a Text component inside the item.
  2. Type this, with two spaces before Y:
{{item.date_published|date("jS F,  Y")}}
  1. Publish and open the page.

Expected: 6th October, 2026
Actual: 6th October,&10b00-07:00; 2026

Suggested fix

Leave everything between {{ and }} exactly as typed. Turning extra spaces into &nbsp; makes sense for visible text, but inside an expression it changes the code. I’d expect any double space inside an expression to be changed the same way; a date format is just where it shows up.

Workaround

Use a single space inside the braces. If you want a wider gap, put the extra space after the closing }}, where &nbsp; does no harm.

Check your own sites

Two CMS templates in my project library (“Posts” and “Single Post”) had the same double space, as j F Y with two spaces before Y. I don’t know whether I added them or they came from a stock template. If it’s the stock one, a lot of sites could have this. If a date on your site shows something like &10b00-07:00;, this is the cause.