mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 19:06:16 +01:00
Fixed fatal error in admin if POST request has data in it [#2074]
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
# v1.10.5
|
||||||
|
## dd/mm/2021
|
||||||
|
|
||||||
|
1. [](#bugfix)
|
||||||
|
* Fixed fatal error in admin if POST request has `data` in it [#2074](https://github.com/getgrav/grav-plugin-admin/issues/2074)
|
||||||
|
|
||||||
# v1.10.4
|
# v1.10.4
|
||||||
## 02/17/2021
|
## 02/17/2021
|
||||||
|
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ class Admin
|
|||||||
$name = $file->getBasename('.yaml');
|
$name = $file->getBasename('.yaml');
|
||||||
|
|
||||||
// Check that blueprint exists and is not hidden.
|
// Check that blueprint exists and is not hidden.
|
||||||
$data = $admin->data('config/'. $name);
|
$data = $admin->data('config/'. $name, null);
|
||||||
if (!is_callable([$data, 'blueprints'])) {
|
if (!is_callable([$data, 'blueprints'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -838,12 +838,12 @@ class Admin
|
|||||||
* Gets configuration data.
|
* Gets configuration data.
|
||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @param array $post
|
* @param array|null $post
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return object
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
public function data($type, array $post = [])
|
public function data($type, ?array $post = [])
|
||||||
{
|
{
|
||||||
static $data = [];
|
static $data = [];
|
||||||
|
|
||||||
@@ -851,9 +851,11 @@ class Admin
|
|||||||
return $data[$type];
|
return $data[$type];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$post) {
|
if (null !== $post && !$post) {
|
||||||
$post = $this->grav['uri']->post();
|
$post = $this->grav['uri']->post()['data'] ?? null;
|
||||||
$post = $post['data'] ?? [];
|
if (!is_array($post)) {
|
||||||
|
$post = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if a data type is plugin-provided, before looking into core ones
|
// Check to see if a data type is plugin-provided, before looking into core ones
|
||||||
|
|||||||
@@ -2695,9 +2695,8 @@ class AdminController extends AdminBaseController
|
|||||||
protected function prepareData(array $data)
|
protected function prepareData(array $data)
|
||||||
{
|
{
|
||||||
$type = trim("{$this->view}/{$this->admin->route}", '/');
|
$type = trim("{$this->view}/{$this->admin->route}", '/');
|
||||||
$data = $this->admin->data($type, $data);
|
|
||||||
|
|
||||||
return $data;
|
return $this->admin->data($type, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user