Closed hhentschel closed 9 months ago
Could solve the issue myself. I am not sure if this is the expected order to delete sites, but before deleting a site i had to disable/set inactive a site within the setting of a structure. Then wait that the entries are saved again and then go to the sites settings and delete a site.
@hhentschel Can you try searching your logs for that error message (storage/logs/
)? If you can find it, please post the stack trace that follows it.
@brandonkelly That's what I found in the web.log. error message and stack trace. replaced my url with xyz.com
2024-02-13 08:26:15 [web.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Undefined array key 2 in /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/elements/Entry.php:891
Stack trace:
#0 /home/oromomic/www/xxx.com/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(2, 'Undefined array...', '/home/oromomic/...', 891)
#1 /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/elements/Entry.php(891): craft\web\ErrorHandler->handleError(2, 'Undefined array...', '/home/oromomic/...', 891)
#2 /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/helpers/ElementHelper.php(295): craft\elements\Entry->getSupportedSites()
#3 /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/controllers/ElementsController.php(300): craft\helpers\ElementHelper::supportedSitesForElement(Object(craft\elements\Entry), true)
#4 [internal function]: craft\controllers\ElementsController->actionEdit(Object(craft\elements\Entry), 10202)
#5 /home/oromomic/www/xyz.com/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#6 /home/oromomic/www/xyz.com/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#7 /home/oromomic/www/xyz.com/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('edit', Array)
#8 /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/web/Application.php(305): yii\base\Module->runAction('elements/edit', Array)
#9 /home/oromomic/www/xyz.com/craft/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('elements/edit', Array)
#10 /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/web/Application.php(290): yii\web\Application->handleRequest(Object(craft\web\Request))
#11 /home/oromomic/www/xyz.com/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#12 /home/oromomic/www/xyz.com/craft/web/index.php(12): yii\base\Application->run()
#13 {main} {"memory":4186512,"exception":"[object] (yii\\base\\ErrorException(code: 2): Undefined array key 2 at /home/oromomic/www/xyz.com/craft/vendor/craftcms/cms/src/elements/Entry.php:891)"}
Hey, I have the same issue - when the site removal is applied via project config. I think it only applies to pages that have matrix on them. Would be happy about some hints how to tackle this, as I need to apply this change via project-config
Sorry, missed your last response @hhentschel. Thanks for posting that.
Believe I just fixed this for the next releases. @maxstrebel you can test by changing your craftcms/cms
requirement in composer.json to one of the following values:
4.x-dev as 4.9.6
(Craft 4.9)4.10.x-dev as 4.10.0-beta.1
(Craft 4.10 beta)5.x-dev as 5.1.8
(Craft 5.1)5.2.x-dev as 5.2.0-beta.1
^5.2.0-beta.2
(Craft 5.2 beta)Then run composer update
.
Thanks @brandonkelly – that seems to do the job 🙏
Great, thanks for confirming!
Craft 4.9.7 and 5.1.9 are out now with that fix.
@brandonkelly
Hey Brandon - thank you for doing the fix so quickly. I work on the project with @maxstrebel.
Unfortunately I noticed the following behaviour:
If I do the following:
Why I think it can be related to that issue ->
If I do the following:
I end up with the same php error: Undefined array key 1 related to the sites.
I have a hard time making sense of it. Do you think this issue could be related?
I think we might have committed to early. The generation of the YAML files takes very long in this project. I just thought I can reproduce but after a minute the deleted files were recreated. We will test this together tomorrow morning and write again.
What happened?
Description
I updated to latest version (4.7.2.1) and deleted some sites and one site group I don't need anymore. I also changed site name handles. After that, I cannot open entries in the control panel. Seems that Site ID are mixed up or something. It gives a php error: Undefined array key 2
Steps to reproduce
I tried to resave entries via cli but get the same error there.
Craft CMS version
4.7.2.1
PHP version
8.1.27
Operating system and version
MacOS X 13.21.1
Database type and version
MariaDB 10.6.16
Image driver and version
Imagick 3.7.0 (ImageMagick 7.1.0-62)
Installed plugins and versions
CKEditor | 3.6.0 CP Field Inspect | 1.4.4 Expanded Singles | 2.0.5 ImageOptimize | 4.0.5 Image Resizer | 3.0.9 Neo | 4.0.2 QRCode | 2.1.0 SEOmatic | 4.0.37 Twigpack | 4.0.0-beta.4