mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 11:34:36 +08:00
Prevent error if no input is given in create actions
This commit is contained in:
parent
a61929730e
commit
262a934747
|
@ -55,7 +55,7 @@ class CreateDiscussionController extends AbstractCreateController
|
|||
$actor = $request->getAttribute('actor');
|
||||
|
||||
$discussion = $this->bus->dispatch(
|
||||
new StartDiscussion($actor, array_get($request->getParsedBody(), 'data'))
|
||||
new StartDiscussion($actor, array_get($request->getParsedBody(), 'data', []))
|
||||
);
|
||||
|
||||
// After creating the discussion, we assume that the user has seen all
|
||||
|
|
|
@ -41,7 +41,7 @@ class CreateGroupController extends AbstractCreateController
|
|||
protected function data(ServerRequestInterface $request, Document $document)
|
||||
{
|
||||
return $this->bus->dispatch(
|
||||
new CreateGroup($request->getAttribute('actor'), array_get($request->getParsedBody(), 'data'))
|
||||
new CreateGroup($request->getAttribute('actor'), array_get($request->getParsedBody(), 'data', []))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class CreatePostController extends AbstractCreateController
|
|||
protected function data(ServerRequestInterface $request, Document $document)
|
||||
{
|
||||
$actor = $request->getAttribute('actor');
|
||||
$data = array_get($request->getParsedBody(), 'data');
|
||||
$data = array_get($request->getParsedBody(), 'data', []);
|
||||
$discussionId = array_get($data, 'relationships.discussion.data.id');
|
||||
$ipAddress = array_get($request->getServerParams(), 'REMOTE_ADDR', '127.0.0.1');
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class CreateUserController extends AbstractCreateController
|
|||
protected function data(ServerRequestInterface $request, Document $document)
|
||||
{
|
||||
return $this->bus->dispatch(
|
||||
new RegisterUser($request->getAttribute('actor'), array_get($request->getParsedBody(), 'data'))
|
||||
new RegisterUser($request->getAttribute('actor'), array_get($request->getParsedBody(), 'data', []))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user