1
0
mirror of https://github.com/flarum/core.git synced 2025-08-09 18:07:02 +02:00

Fix post policy for PHP 8 (#3145)

* Add tests to verify post policy works as intended
* Fix "reply" post edit setting not working on PHP 8

Fixes #3144
This commit is contained in:
Clark Winkelmann
2021-11-01 21:38:21 +01:00
committed by GitHub
parent 9e1b05a358
commit 8a69c890e7
2 changed files with 125 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ class PostPolicy extends AbstractPolicy
if ($allowEditing === '-1'
|| ($allowEditing === 'reply' && $post->number >= $post->discussion->last_post_number)
|| ($post->created_at->diffInMinutes(new Carbon) < $allowEditing)) {
|| (is_numeric($allowEditing) && $post->created_at->diffInMinutes(new Carbon) < $allowEditing)) {
return $this->allow();
}
}