getgrav / getgrav/grav-plugin-admin

"Array to string conversion" exception when saving a page with field type "pages" and "multiple: true"

Open
#1,024 10 comments 1 reaction 1 assignee Claimed by @mahagr View on GitHub
bug
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

Tested on new installs of
- Grav v1.1.17 - Admin v1.2.14
- Grav v1.2.0-rc.1 - Admin v1.3.0-rc.1

Environment:
- macOS 10.12.3
- Safari 10.0.3
- localhost (with MAMP PRO)
- PHP 7.1

Repro steps:
1. Install Grav with the admin plugin.
2. Open `system/blueprints/pages/default.yaml` (just for speed, but I can reproduce the bug with a page blueprint found in a theme as well)
3. In the `content` tab, add this field (line 38):
```
header.content.items:
label: Pages
type: pages
multiple: true
```
4. Edit the Home page through the admin panel.
5. In the "Content" tab, scroll to the bottom and enter "Home" in the "Pages" field. Select the Home page from the dropdown so it becomes a token in the input.
6. Try to save the page.

Expected result: No error.
Actual result:
```
Whoops \ Exception \ ErrorException (E_NOTICE)
Array to string conversion
```

This does not happen if the field doesn't have `multiple: true`. I also tried adding `validation: type: array` but it doesn't fix it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.