tablemaker icon indicating copy to clipboard operation
tablemaker copied to clipboard

Cloning Table + Save → Undefined Array Key

Open Jones-S opened this issue 4 months ago • 1 comments

Describe the bug

I have a table that looks like:

Image

And if I clone the table (without changing anything (no keys, no values) and save the post, I get:

yii\base\ErrorException: Undefined array key 7 in /var/www/html/vendor/verbb/tablemaker/src/fields/TableMakerField.php:200
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(2, 'Undefined array...', '/var/www/html/v...', 200)
#1 /var/www/html/vendor/verbb/tablemaker/src/fields/TableMakerField.php(200): craft\web\ErrorHandler->handleError(2, 'Undefined array...', '/var/www/html/v...', 200)
#2 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2658): verbb\tablemaker\fields\TableMakerField->validateTableData(Object(benf\neo\elements\Block), NULL)
#3 /var/www/html/vendor/yiisoft/yii2/validators/InlineValidator.php(77): craft\base\Element->validateCustomFieldAttribute('field:tablemake...', Array, Object(yii\validators\InlineValidator), Array)
#4 /var/www/html/vendor/yiisoft/yii2/validators/Validator.php(260): yii\validators\InlineValidator->validateAttribute(Object(benf\neo\elements\Block), 'field:tablemake...')
#5 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2544): yii\validators\Validator->validateAttributes(Object(benf\neo\elements\Block))
#6 /var/www/html/vendor/yiisoft/yii2/base/Model.php(370): craft\base\Element->afterValidate()
#7 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2505): yii\base\Model->validate(Array, true)
#8 /var/www/html/vendor/spicyweb/craft-neo/src/elements/Block.php(281): craft\base\Element->validate(NULL, true)
#9 /var/www/html/vendor/spicyweb/craft-neo/src/Field.php(871): benf\neo\elements\Block->validate()
#10 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2658): benf\neo\Field->validateBlocks(Object(craft\elements\Entry), NULL)
#11 /var/www/html/vendor/yiisoft/yii2/validators/InlineValidator.php(77): craft\base\Element->validateCustomFieldAttribute('field:pageBuild...', Array, Object(yii\validators\InlineValidator), Object(benf\neo\elements\db\BlockQuery))
#12 /var/www/html/vendor/yiisoft/yii2/validators/Validator.php(260): yii\validators\InlineValidator->validateAttribute(Object(craft\elements\Entry), 'field:pageBuild...')
#13 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2544): yii\validators\Validator->validateAttributes(Object(craft\elements\Entry))
#14 /var/www/html/vendor/yiisoft/yii2/base/Model.php(370): craft\base\Element->afterValidate()
#15 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2505): yii\base\Model->validate(Array, true)
#16 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3300): craft\base\Element->validate(NULL)
#17 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1109): craft\services\Elements->_saveElementInternal(Object(craft\elements\Entry), true, false, NULL, Array, false, false)
#18 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1507): craft\services\Elements->saveElement(Object(craft\elements\Entry), true, true, NULL, false, false)
#19 [internal function]: craft\controllers\ElementsController->actionApplyDraft()
#20 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#22 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('apply-draft', Array)
#23 /var/www/html/vendor/craftcms/cms/src/web/Application.php(348): yii\base\Module->runAction('elements/apply-...', Array)
#24 /var/www/html/vendor/craftcms/cms/src/web/Application.php(647): craft\web\Application->runAction('elements/apply-...', Array)
#25 /var/www/html/vendor/craftcms/cms/src/web/Application.php(310): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#26 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#27 /var/www/html/web/index.php(12): yii\base\Application->run()
#28 {main}

Steps to reproduce

(Hopefully this let's it reproduce)

  1. Create a Neo field (in my case "Page Builder" and add a Tablemaker block)
Image
  1. Add table and some content
  2. Clone table (or rather the pagebuilder block including the table)
  3. Save post

Craft CMS version

Craft Pro 4.16.11

Plugin version

4.0.17

Multi-site?

No

Additional context

Application Info

PHP version: | 8.1.32 OS version: Linux 6.8.0-31-generic DB: MariaDB 10.3.39 Image driver: Imagick 3.8.0 (ImageMagick 6.9.11-60) Craft Version: Craft Pro 4.16.11 Yii: 2.0.52 Twig: v3.15.0 Guzzle version: 7.10.0

Table Maker: v4.0.17

Jones-S avatar Aug 25 '25 11:08 Jones-S

Note: Ok I think I was able to narrow the problem down. Even If I copy paste the block to another page I get similar errors. I think it is because of the Dropdown field. If the table is copied the Dropdown options are missing and therefore it fails. I think that is the actual bug.

Jones-S avatar Aug 25 '25 12:08 Jones-S