Page Settings dropdowns not populating on 4.7.1

Silverstripe Version: 4.7.1


Struggling to get to be bottom of an odd bug after updating from 4.6.1 to 4.7.1:

In any page Settings, the “Viewer Groups” field and (in certain circumstances) the “Parent page” field do not pre-populate with the current value, meaning the value is wiped when saving the page.

The issue goes away when I downgrade to 4.6.1, but only seems to occur in particular environments, i.e. I can’t reproduce it locally.

For the “Parent page” field, the issue only seems to occur if the page is on the 3rd level.

Does anyone have an idea what could be causing this?

Things I’ve Tried:

  • dev/build?flush=1
  • Removing database.yml
  • Changing database collation
  • Downgrading to 4.7.0
  • Reproduced on a completely different 4.7.0 site
  • Checked dev tools, no errors

I too have experienced this in theTreeDropdownField. This is occurring where ever an internal Page Selection is required, e,g, RedirectorPage, Links module.

Client has to currently use the External Website field to avoid the dropdown clearing whenever the page is published.

I too can’t reproduce locally.

Ah yes, I can reproduce it with the TreeDropdownField on Redirector Page too. Seems fine when selecting a top-level page, but upon selecting a second-level page and clicking save, the dropdown becomes empty.

Should add I’ve also just reproduced it on 4.7.3

James, What type of hosting is it on? The fact that you and I can’t reproduce it on our local machines makes me wonder if it is a server issue.

For me it is happening on a standard apache cPanel installation. My local machine is running WAMP 3.2+.

Have you managed to find any work arounds for this issue?

Interesting. I’m using cPanel too, and MAMP locally.

Reproduced on 2 different cPanel hosts. (One using MySQL another using MariaDB).

I’ve been trying to work out if it’s related to the MySQL changes in Silverstripe 4.7.0.

I just connected my local install to my remote database, and the issue still didn’t occur locally. So this would indicate it is not related to the database. :thinking:

I’ve narrowed this down to the following:

The reason it doesn’t work remotely but does locally, is because json_encode is wrapping numeric values in quotes on the remote server, but on the local setup it doesn’t wrap these values in quotes.

This causes the following difference in the data-state attribute for TreeDropDown fields:



It seems to be that up until 4.7.0, this didn’t matter, and that even with the quotes, the value would get parsed correctly, but something appears to have changed in 4.7.0 which has stopped it from being able to parse the numeric values when wrapped in quotes.

I’m yet to work out:

  • What changed in Silverstripe 4.7.0 to cause this.
  • Why json_encode performs differently on local vs remote.

Opened an issue:

Managed to get to the bottom of this, see here for the fix: TreeDropdownField fails to parse value (4.7.0+) · Issue #9880 · silverstripe/silverstripe-framework · GitHub

1 Like

Thanks for your hard work and excellent sleuthing James.

1 Like