MultipleSelect field: Array to string conversion error

Permalink Browser Info Environment
I got error when I try to add a multiple select field.

This is a part of error occurring

$optionValues = isset($this->miscFields['optionValues']) ? $this->miscFields['optionValues'] : [];
        $defaultValues = isset($this->miscFields['defaultValues']) ? $this->miscFields['defaultValues'] : [];
        $selectMultiple = $form->selectMultiple($view->field($slug), $optionValues, $defaultValues, $this->miscFields);


I've fixed by changing this part like this

$optionValues = [];
        if (isset($this->miscFields['optionValues'])) {
            $optionValues = $this->miscFields['optionValues'];
            unset($this->miscFields['optionValues']);
        }
        $defaultValues = [];
        if (isset($this->miscFields['defaultValues'])) {
            $defaultValues = $this->miscFields['defaultValues'];
            unset($this->miscFields['defaultValues']);
        }
        $selectMultiple = $form->selectMultiple($view->field($slug), $optionValues, $defaultValues, $this->miscFields);


Full trace:

Array to string conversion
/var/www/html/web/concrete/src/Form/Service/Form.php(834): Whoops\Exception\ErrorException->null   
/var/www/html/web/concrete/src/Form/Service/Form.php(834): Whoops\Run->handleError   
/var/www/html/web/concrete/src/Form/Service/Form.php(650): Concrete\Core\Form\Service\Form->serializeMiscFields   
/var/www/html/web/packages/block_developer/src/BlockDeveloper/Field/Form/SelectMultiple.php(23): Concrete\Core\Form\Service\Form->selectMultiple   
/var/www/html/web/packages/block_developer/src/BlockDeveloper/Field/Field.php(352): Devoda\BlockDeveloper\BlockDeveloper\Field\Form\SelectMultiple->getHtml   
/var/www/html/web/packages/block_developer/src/BlockDeveloper/FieldType/MultipleSelect/MultipleSelect.php(285): Devoda\BlockDeveloper\BlockDeveloper\Field\Field->generateFormContent   
/var/www/html/web/packages/block_developer/src/BlockDeveloper/Block/BlockController.php(236): Devoda\BlockDeveloper\BlockDeveloper\FieldType\MultipleSelect\MultipleSelect->renderForm   
/var/www/html/web/packages/tok/blocks/sdgs/form.php(2): Devoda\BlockDeveloper\BlockDeveloper\Block\BlockController->renderForm   
/var/www/html/web/concrete/src/Block/View/BlockView.php(380): null->include   
/var/www/html/web/packages/tok/blocks/sdgs/add.php(2): Concrete\Core\Block\View\BlockView->inc   
/var/www/html/web/concrete/src/Block/View/BlockView.php(267): null->include   
/var/www/html/web/concrete/src/View/AbstractView.php(164): Concrete\Core\Block\View\BlockView->renderViewContents   
/var/www/html/web/concrete/views/dialogs/page/add_block.php(102): Concrete\Core\View\AbstractView->render   
/var/www/html/web/concrete/src/View/View.php(308): null->include

Type: Discussion
Status: In Progress
concrete5cojp
View Replies:
ramonleenders replied on at Permalink Reply
ramonleenders
Hi there,

Thanks for pointing this out. I fixed this and the new version is ready for download right now.

See the CHANGELOG for the full change list! Thanks for being so precise in mentioning the error and fix :)

Kind regards
Ramon
concrete5cojp replied on at Permalink Reply
concrete5cojp
Thanks!

concrete5 Environment Information

# Concrete Version
Core Version - 9.1.3
Version Installed - 9.1.3
Database Version - 20220908074900

# Hostname
tok

# Environment
production

# Database Information
Version: 10.10.2-MariaDB
SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

# Concrete Packages
Advanced HTML Block (1.1), Block Developer (1.4.2), TOKYO OHKA KOGYO (0.0.4)

# Concrete Overrides
blocks/html/composer.php, blocks/html, src/Navigation/Breadcrumb/PageBreadcrumbFactory.php, src/Navigation/Breadcrumb, src/Navigation

# Concrete Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.4.54 (IUS) PHP/8.1.13

# Server API
apache2handler

# PHP Version
8.1.13

# PHP Extensions
apache2handler, bcmath, bz2, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, intl, json, libxml, mbstring, memcached, msgpack, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, recode, Reflection, session, shmop, SimpleXML, sockets, sodium, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
upload_max_filesize - 2M
zend.exception_string_param_max_len - 0
mbstring.regex_retry_limit - 1000000
mbstring.regex_stack_limit - 100000
memcached.sess_lock_max_wait - not set
memcached.sess_lock_wait_max - 150
memcached.sess_server_failure_limit - 0
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
unserialize_max_depth - 4096

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.