Skip to content

Commit

Permalink
Fix rawurlencode null arg deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbennett committed Jan 6, 2025
1 parent 33f8de6 commit e3f2c6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/Document/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public function invoke(?array $args): bool
$this->model->acl_allowed = $this->model->active_user
&& $this->model->active_user->getOption(\BNETDocs\Libraries\User\User::OPTION_ACL_DOCUMENT_MODIFY);

$this->model->document_id = Router::query()['id'] ?? null;

if (!$this->model->acl_allowed)
{
$this->model->_responseCode = HttpCode::HTTP_FORBIDDEN;
$this->model->error = $this->model->active_user ? EditModel::ERROR_ACL_NOT_SET : EditModel::ERROR_NOT_LOGGED_IN;
return true;
}

$this->model->document_id = Router::query()['id'] ?? null;

try { $this->model->document = new \BNETDocs\Libraries\Document($this->model->document_id); }
catch (\UnexpectedValueException) { $this->model->document = null; }

Expand Down
2 changes: 1 addition & 1 deletion src/Templates/Document/Edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $description = 'This form allows an individual to edit a document.';
$url = '/document/edit';
$comments = $this->getContext()->comments;
$document_id = $this->getContext()->document_id;
$document_url = ($this->getContext()->document ? $this->getContext()->document->getURI() : UrlFormatter::format('/document/' . rawurlencode($document_id)));
$document_url = ($this->getContext()->document ? $this->getContext()->document->getURI() : UrlFormatter::format('/document/' . rawurlencode($document_id ?? '')));
$error = $this->getContext()->error;
switch ($error)
{
Expand Down

0 comments on commit e3f2c6b

Please sign in to comment.