@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix PHP 8.1 "preg_replace(null)" exception in PhabricatorEditorURIEngine.php

Summary:
Passing `null` to `preg_replace()` is deprecated behavior since PHP 8.1.
Thus check if `$repository->getRepositorySlug()` is set before passing that to `escapeToken()`.

```
ERROR 8192: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated at [<phorge>/src/infrastructure/editor/PhabricatorEditorURIEngine.php:283]
```

Closes T15824

Test Plan: Unknown.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

Subscribers: chris, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15824

Differential Revision: https://we.phorge.it/D26036

+4 -1
+4 -1
src/infrastructure/editor/PhabricatorEditorURIEngine.php
··· 141 141 142 142 $variables = array( 143 143 'r' => $this->escapeToken($repository->getCallsign()), 144 - 'n' => $this->escapeToken($repository->getRepositorySlug()), 144 + 'n' => null, 145 145 'd' => $this->escapeToken($repository->getID()), 146 146 'p' => $this->escapeToken($repository->getPHID()), 147 147 ); 148 + if ($repository->getRepositorySlug()) { 149 + $variables['n'] = $this->escapeToken($repository->getRepositorySlug()); 150 + } 148 151 149 152 return $this->newTokensWithVariables($tokens, $variables); 150 153 }