silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 823 forks source link

[Emergency] Uncaught TypeError: Illegal offset type #10955

Closed sabina-talipova closed 11 months ago

sabina-talipova commented 11 months ago

Description

When deleting a page that uses TreeDropdownField, the server issues a 500 error with the following message "[Emergency] Uncaught TypeError: Illegal offset type". The page is safely deleted.

Steps to reproduce issue

use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Forms\TreeDropdownField;

class Page extends SiteTree { private static $has_one = [ 'MyPage' => SiteTree::class, ];

public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TreeDropdownField::create('MyPage', 'MyPage', SiteTree::class)); return $fields; } }


- I create Page
- I add page to MyPage through the TreeDropdownField
- I publish Page
- I click "Actions menu" and "Unpublish and archive " 
- I see error style toast with message "Archived New Page" (in Network tab I see 500 Error with "[Emergency] Uncaught TypeError: Illegal offset type" )
- I refresh page and I see error screen with "Illegal offset type"
- I check DB, page was deleted

## AC's
## PR