1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-24 13:38:19 +01:00
phorge-phorge/src/infrastructure/diff
Andre Klapper dd24c94b07 Fix PHP 8.1 "strlen(null)" exceptions block creating a diff in Differential web interface
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=18554ea76ceb), phorge(head=diffDiff, ref.master=e11c5486c92b, ref.diffDiff=e11c5486c92b)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php:160]
```

Closes T15430

Test Plan:
After applying these two changes, going to `/differential/diff/create/`, pasting the content of a diff file into the "Raw Diff" field, and selecting the "Create Diff" button, `/differential/diff/1/` rendered correctly in web browser.

Also, install xdebug and try again with coverage mode enabled in your php.ini of your PHP cli.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15430

Differential Revision: https://we.phorge.it/D25262
2023-06-02 20:40:42 +02:00
..
__tests__ Extract scope line selection logic from the diff rendering engine so it can reasonably be iterated on 2019-02-19 10:55:10 -08:00
engine Fix an issue where we may "min()" an empty array when viewing a revision with no changesets 2022-04-20 13:03:59 -07:00
inline Put a readthrough cache in front of inline context construction 2020-05-20 14:28:37 -07:00
interface Formally track "initial", "committed", and "active" states for inline comments 2021-03-29 09:00:27 -07:00
prose Fix an issue where prose diffing may fail after hitting the PCRE backtracking limit 2020-07-23 07:46:15 -07:00
query Put a readthrough cache in front of inline context construction 2020-05-20 14:28:37 -07:00
view Fix PHP 8.1 "strlen(null)" exceptions block creating a diff in Differential web interface 2023-06-02 20:40:42 +02:00
viewstate Fix an issue where non-ID changeset state keys were used as changeset IDs 2020-05-04 16:05:05 -07:00
PhabricatorChangesetResponse.php Make "renderer", "engine", and "encoding" sticky across reloads in Differential and Diffusion 2020-04-19 08:59:09 -07:00
PhabricatorDifferenceEngine.php Continue moving classes with no callers in libphutil or Arcanist to Phabricator 2020-02-12 13:14:04 -08:00
PhabricatorDiffScopeEngine.php Make very minor generality improvements to the scope selector 2019-04-30 06:52:29 -07:00
PhabricatorInlineCommentController.php Update client logic for inline comment "Save" and "Cancel" actions 2021-03-29 09:00:27 -07:00