Multilingual Setup leads to an error on page insert from root
Permalink 5 2 Browser Info Environment- Load a new language which wanted a slug like /de
- Set this as default
- Delete the old default language
- Add any other language with a slug
- Delete /de
- Add de but with slug / to show as the new main Home
- Delete the other random language that was just there as a placeholder to add de without a slug
- Insert page from root using "edit mode" -> recieve Error message from DBLA that parent ID should not be empty
- See the query from Page.php#getDraftsParentPage
- Try select * from PagePaths pp inner join Pages p on pp.cID = p.cID inner join SiteLocales sl on p.siteTreeID = sl.siteTreeID where cPath = '/!drafts' and sl.siteID = 1
- Get no resault
- Look into the database table "PagePaths" ... there is indeed a row with "/!drafts"
- Check the query "select * from PagePaths pp inner join Pages p on pp.cID = p.cID inner join SiteLocales sl on p.siteTreeID = sl.siteTreeID" without a 'where' -> get an ID
- Check the ids
- Find a row in "PagePaths" where cPath is empty
- Update it with '/!drafts'
- See the thins is working again
I found serveral issues and fixes for similar problems, but I dont think they tried to change the slug in that way or something.
What generally happend was the insertions of empty string for cPath instead of /!drafts
Anywhere in the add/delete process of languages this got corrupted.
I think this could be small bug anywhere on the way - yet it leads to big impact -> Not being able to add pages to the root.
Hopefully someone can find the bug with this. Or maybe fix his/her side
The message on insert:
An exception occurred while executing 'insert into Pages (cID, siteTreeID, ptID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, pkgID, cIsActive, cIsDraft) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [241, null, "5", null, "1", "TEMPLATE", null, 179, 0, 0, 0, 1]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'cParentID' cannot be null
Status: New

An exception occurred while executing 'insert into Pages (cID, siteTreeID, ptID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, pkgID, cIsActive, cIsDraft) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [192, null, "5", null, "1", "TEMPLATE", null, 179, 0, 0, 0, 1]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'cParentID' cannot be null
Seams to be the same error as in 2017 which was fixed here:
https://github.com/concrete5/concrete5/commit/1c5e1a11a2c266bb52d801...