1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00
Commit graph

16047 commits

Author SHA1 Message Date
Waldir Pimenta
c49eeb235e Improve command line prompts in setup issue pages
Summary:
This is a follow-up to D25425, where these improvements to the CLI prompt markers were discussed.

Changes included in this revision:

- Build all prompts the same way
- Remove space after the prompt marker (add it via CSS instead)
- Add server path prefix
- Make the prompt unselectable

Test Plan:
- Visit any of the setup issue pages, e.g. <PHORGE_URL>/config/issue/auth.config-unlocked/ (after ensuring that the corresponding issue is present — in this case, by doing `./bin/auth unlock`)
- For example, Deactivate all PHP extensions to trigger each /config/issue/extension.gd/ etc.
- For example, update at least up to `dc10a7e69ea3` to see the database upgrade tip etc.
- Confirm that the command line prompts now include the path prefix
- Confirm that selecting the command via double-click (or click-and-drag) does not select the prompt

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #ux, #config

Differential Revision: https://we.phorge.it/D25466
2023-12-07 16:22:24 +00:00
Mukunda Modell
6c8329fb66 Include 'published' date of posts in Phame Atom feeds
Summary:
Metadata of Phame blog posts includes the 'updated' date of a blog post. Make them also include the original 'published' date.

Patch written by @20after4 from:

https://phabricator.wikimedia.org/rPHAB3de500bfc845759d6da82180df0adfc12f973463

Closes T15686

Test Plan:
* Go to the Atom feed of blog 1 at `/phame/blog/feed/1/` and look at this `<feed>`'s source
* Apply patch and do the same, see additional `<published>` entry just like the `<updated>`
* Edit the last blog post in blog 1, then check Atom feed and verify that the published and updated date stamp differ as expected

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, 20after4, Cigaryno

Maniphest Tasks: T15686

Differential Revision: https://we.phorge.it/D25490
2023-12-06 11:34:38 -08:00
Andre Klapper
5ddca7da55 Fix PHP 8.1 "strlen(null)" exception rendering dashboard panel with latest tasks when custom text field configured
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]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php:33]
```

Closes T15684

Test Plan: After configuring a custom `text` field and a dashboard panel to query and listed the latest created tasks, access the panel.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15684

Differential Revision: https://we.phorge.it/D25488
2023-12-06 10:32:58 -08:00
Bartosz Dziewoński
c8a9270060 Use user's preferred font for inline code snippets too
Summary:
Use user's preferred font for inline code snippets,
like we already do for block code snippets.

Test Plan:
Set a non-default font in Settings → Display Preferences → Monospaced Font.
Make sure that it applies to both single-tick (inline) and triple-tick (block)
code snippets in comments.

For example, enter:

    42px Tahoma

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15682

Differential Revision: https://we.phorge.it/D25486
2023-12-06 16:50:59 +01:00
Andre Klapper
e610e739cb Fix PHP 8.1 exceptions rendering task when custom select field configured
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.

In the other case, do not call `json_decode()` when passing null to it.

```
EXCEPTION: (RuntimeException) json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> json_decode(NULL, boolean) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php:44]
```

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php:76]
```

Closes T15683

Test Plan: After configuring a custom `select` field, access a task.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15683

Differential Revision: https://we.phorge.it/D25487
2023-12-05 10:24:17 -08:00
Andre Klapper
acedbd022d Fix exception in Transaction Log after renaming Pholio Mock image: Call to undefined method PholioImageSequenceTransaction::renderHandleLink()
Summary:
Replace call to undefined `renderHandleLink()` with `renderHandle()`.

Additionally, pass `head_key($new)` instead of `key($new)`. This might not be needed strictly speaking for this very issue but should not harm either as several images in a mock can be renamed at once.

```
EXCEPTION: (Error) Call to undefined method PholioImageSequenceTransaction::renderHandleLink() at [<phorge>/src/applications/pholio/xaction/PholioImageSequenceTransaction.php:32]
```

Closes T15680

Test Plan:
* Rename the title of an image in a Pholio mock.
* Go to `/feed/transactions/query/all/` which now renders instead of showing an error, and shows two entries:
* `user renamed an image (newname.jpg) from oldname.jpg to newname.jpg.` and `user updated an image's (newname.jpg) sequence.`
(However, separate T15679 will still show up in the error log after this change.)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15680

Differential Revision: https://we.phorge.it/D25482
2023-12-04 19:32:01 -08:00
Christopher Speck
99ee9357ef Updates for Mercurial's HTTP protocol
Summary:
While testing https://secure.phabricator.com/D21864 I ran into some issues getting mercurial HTTP access working. Using wireshark I confirmed that my local mercurial 6.4 was not including command arguments as HTTP headers but in the querystring.

I didn't dig too deep into understanding when/why this started happening. The protocol documents this in [[ https://repo.mercurial-scm.org/hg/file/tip/mercurial/helptext/internals/wireprotocol.txt | wireprotocol.txt ]].

>Command arguments can be sent multiple ways. The simplest is part of the URL query string using ``x-www-form-urlencoded`` encoding (see Python's ``urllib.urlencode()``. However, many servers impose length limitations on the URL. So this mechanism is typically only used if the server doesn't support other mechanisms.

Based on that either the mercurial on the server is really old (it's 6.1.1 tho) or maybe some other parsing/info passing in Phab's handling of the wire protocol is causing the client to downgrade the wire protocol support.

Cherry-picked from:

https://secure.phabricator.com/D21867

https://secure.phabricator.com/rP0b6e758978a9691bd5ad25db4aa4c4301640a9a9

Test Plan: Host mercurial repo using HTTP, test push/pull.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25471
2023-11-30 20:16:03 -05:00
Andre Klapper
c3850a3c15 Fix PHP 8.1 "strlen(null)" exception removing custom alt text from image file
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.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/xaction/PhabricatorFileAltTextTransaction.php:59]
```

Closes T15678

Test Plan: Add and remove alt text on an image file; then go to `/feed/query/all/`

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15678

Differential Revision: https://we.phorge.it/D25481
2023-11-28 14:52:00 +01:00
Matthew Bowker
4d4712b58d Remove Chatlog entirely
Summary:
This commit removes ChatLog entirely.  All of the application files are removed, and the migrations used are stubbed out. I stubbed the migrations as that allows for existing installs to make no changes, but new installs will not create the database.

Fixes T15126

Test Plan: Loaded up http://phorge.local/chatlog and confirmed the 404.  Loaded up http://phorge.local/applications/view/PhabricatorChatLogApplication and confirmed the 404.  Created a new database prefix and ran `bin/storage upgrade` against it, confirmed that the chatlog database was not created.  Restored another prefix (an old one) and ran `bin/storage upgrade` and confirmed database was not deleted.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Cigaryno

Maniphest Tasks: T15126

Differential Revision: https://we.phorge.it/D25480
2023-11-27 11:38:37 -07:00
bob
cf8d5d60a5 Fix a PHP 8.1 deprecated use of strlen with a NULL argument in commit parser
Summary:
With PHP 8.1+ it is not possible to import a commit if the commiter field is not properly defined
Indeed, if the committer is not properly defined, strlen(null) is called, causing a deprecation warning, elevated to exception.
Using strlen() to check string validity is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Fix T15629

Test Plan:
- Push a commit to an observed subversion repository
- Import it via the phorge/bin/repository reparse COMMIT_ID --importing
- The commit should be properly imported and available in Diffusion

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan

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

Maniphest Tasks: T15629

Differential Revision: https://we.phorge.it/D25423
2023-11-22 16:56:20 +01:00
bob
acfb44d667 Fix a PHP 8.1 deprecated use of strlen with a NULL argument on commit page
Summary:
With PHP 8.1+ it is not possible to view a commit if the author field is not properly defined
Indeed, if the commit author is not properly defined, strlen(null) is called, causing a deprecation warning, elevated to exception.
Using strlen() to check string validity is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Fix T15628

Test Plan:
- Push a new commit on a subversion repository (since T15629 is not yet addressed)
- Visualize the commit
- You should not get a RuntimeException

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan

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

Maniphest Tasks: T15628

Differential Revision: https://we.phorge.it/D25422
2023-11-22 16:55:32 +01:00
bob
5bd5266461 Fix a PHP 8.1 deprecated use of strlen with a NULL argument
Summary:
This call prevents users to view a commit in subversion repositories
Indeed, if commiter and/or author field is not properly defined strlen is call with a NULL argument.
Using strlen to check string validity 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.

Fix T15610

Test Plan:
- Sign in (if needed)
- Open a diffusion SVN repository
- Open a commit without user name and or email
- You should be able to view the commit

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15610

Differential Revision: https://we.phorge.it/D25400
2023-11-22 16:54:29 +01:00
Matthew Bowker
1b49165ddd Show more in Application Detail and List view
Summary:
Update the Application Detail view and List View to show a unified set of Badges (Deprecated, etc.), show PHIDs and Monograms on the Application Detail view, allow Applications to register Monograms.

Example of the page /applications/view/PhabricatorDiffusionApplication/:

{F393393}

T15568

Test Plan:
1. Visit /applications/ and see Deprecated badges etc.
2. Visit various Configure buttons from that list and see Monograms, Badges, PHIDs etc.
3. Enjoy screenshots in the comments of this Diff

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey, speck

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey, speck

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

Differential Revision: https://we.phorge.it/D25362
2023-11-21 11:22:23 -07:00
Waldir Pimenta
a741f5d65c Change some instances of "phabricator" to "phorge"
Summary:
Just a small set of replacements in locations that seem innocuous (user-facing messages, documentation, etc.)

Ref T15006

Test Plan:
Nothing should change in terms of behavior. The places where these changes were made should now say "phorge".

Example tests:

- Manage a single User and click on Delete User and see the popup
- Run a test email and check the output
  ./bin/mail send-test --to username
- Visit /maniphest/, shift+click on at least 1 Task, click on Bulk Edit Selected,
  Continue, see the popup
- See the mentioned documentation with your big eyes. Eyes do not explode \o/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15006

Differential Revision: https://we.phorge.it/D25473
2023-11-18 22:14:15 +00:00
Andre Klapper
05f4d5071f Disallow webcrawlers to index Diffusion commits
Summary:
Phorge already sets `Disallow: /diffusion/` and `Disallow: /source/`.
Thus consequently also disallow accessing specific commits via `/r*`.
See https://secure.phabricator.com/T4610 for previous discussions.

Closes T15670

Test Plan:
Go to `/robots.txt` in the web browser.
Cross fingers that more webcrawlers abide by RFC 9309.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15670

Differential Revision: https://we.phorge.it/D25474
2023-11-17 08:45:30 +01:00
Andre Klapper
76ed0c7ff7 Disallow webcrawlers to follow Paste line number anchor links
Summary:
Paste provides line anchor links in every single line of a paste.
If webcrawlers follow these links, they index the very same Paste again.
Thus disallow in robots.txt to reduce unneeded traffic and indexing time.

Closes T15662

Test Plan:
Go to `/robots.txt` in the web browser.
Cross fingers that more webcrawlers abide by RFC 9309.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15662

Differential Revision: https://we.phorge.it/D25461
2023-11-16 11:00:32 +01:00
Andre Klapper
f42dd5819e Fix possible array to string conversion renaming Pholio Mockup image
Summary:
Premising that the `$old` and `$new` variables are 1-element arrays defined as PHID=>title,
this can cause `renderValue()` repeatedly fail when passing an array instead of its value.

Thus pass `head($old)` instead, to get the first value - that is the only one, even if you rename
multiple images (since this Transaction is about a single Mockup image).

Closes T15646

Test Plan:
* Have `phd` running
* Create a Pholio mockup with at least one image

Edit the Pholio mockup and:

1. rename the Titles of an image
2. rename a single Image
3. rename no image

No nuclear implosions. You still see a lovely Feed mentioning each rename.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15646

Differential Revision: https://we.phorge.it/D25441
2023-11-16 10:42:15 +01:00
Valerio Bozzolan
775d141fe6 Audit Feed: less verbose when the author is the committer
Summary:
If the author and the committer are the same person, do not show them twice.

From:

    UsernameFoo committed <commit hash>: <commit msg> (authored by UsernameFoo).

To:

    UsernameFoo committed <commit hash>: <commit msg>

This only affects the feed.

| Before    | After  |
|-----------|-----------|
| {F342758} | {F342764} |

Closes T15528

Test Plan: Do some mixed commits and visit /feed/query/all/. No nuclear implosions.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15528

Differential Revision: https://we.phorge.it/D25421
2023-11-15 13:57:16 +01:00
Andre Klapper
282e37aaf6 Do not expose Contact Numbers settings panel when no SMS support configured
Summary:
It's useless without SMS support and only exposed to the user themselves.

Closes T15486

Test Plan:
Before and after applying this patch,
* Try to access the list of your contact numbers at `/settings/panel/contact/`
* Try to access an existing, previously created contact number at `/auth/contact/1/`
* Try to add a contact number at `/auth/contact/edit/`
* Go to e.g. `/settings/panel/datetime` and check the "Authentication" section in the left sidebar for {nav icon=hashtag, name=Contact Numbers}

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15486

Differential Revision: https://we.phorge.it/D25452
2023-11-13 14:04:16 +01:00
Zero King
361fcd0cac Initialize static variable to make linter happy
Summary: Uninitialized variable defaults to 0 in this context. Make it explicit.

Test Plan: None. No functional change.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25470
2023-11-13 08:52:00 +08:00
Zero King
4535e8753c Fix typo in DiffusionLowLevelGitRefQuery
Summary: $refs_types is undefined.

Test Plan: None. PhabricatorRepositoryRefCursor::TYPE_REF is not used with DiffusionLowLevelGitRefQuery.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25468
2023-11-13 08:50:41 +08:00
Waldir Pimenta
296ce3956b Fix loop in contribution docs
Summary:
The Contributor Introduction lists in the next steps the Contributing Code page;
in its turn, the Contributing Code page links back to the Contributor Introduction page.

This change fixes that infinite loop by adding an actual path forward, adding a link to the Developer Setup page in the Next Steps section of the Contributing Code page.

Test Plan: Open the /book/contrib/article/contributing_code/ URL and confirm that the Developer Setup is included in the Next Steps section.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25465
2023-11-12 21:07:11 +00:00
Zero King
16d9cc12af Enforce viewable MIME types config on PDF documents
Summary:
Let instance admins decide whether to allow PDFs to be viewable as a Web page. See <5ec132bf9e>.

    MOZILLA: Instead of always allowing PDFs to be viewable in the web UI, [...]
    This checks that the PDF mimetype is viewable according to the system
    configuration.

Ref Q83.

Test Plan:
1. Set `files.viewable-mime-types` to exclude application/pdf.
2. Upload a pdf file.
3. See "No document engine can render the contents of this file." in web UI.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25464
2023-11-13 00:12:50 +08:00
Andre Klapper
5d80b3fd88 Fix PHP 8.1 "strlen(null)" exception rendering PHUISegmentBar without a label
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=df6c315ace5f), phorge(head=master, ref.master=3cc5ee6a33df)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarView.php:33]
```

Closes T15622

Test Plan:
After applying this change, page with the PHUISegmentBar without label renders as expected without an exception.

For example, visit this page:

/uiexample/view/PhabricatorAphrontBarUIExample/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15622

Differential Revision: https://we.phorge.it/D25414
2023-11-12 08:54:23 +01:00
David Lawrence
005fea5a14 Fix view policy inheritance on image transforms
Summary:
Inherit viewPolicy from original image in image transforms and warn about Profile transform making transformed images public. Details:

https://hackerone.com/reports/1984060

8358b435a9

Closes T15663

Test Plan:
1. Click {nav View Transforms} on an image file with restrictive view policy.
2. See (Image will be Public) warning on Profile transform.
3. Click on Workcard transform.
4. Go back to {nav View Transforms} page and visit the Workcard transformed file.
5. Check if its view policy matches the original file.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15663

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

Signed-off-by: Zero King <l2dy@icloud.com>
2023-11-12 07:09:10 +08:00
Andre Klapper
90f651d669 Add Diffusion policy capability "Can Edit and View Identities"
Summary:
Make it possible not to allow anyone to edit Diffusion identities.
Make it possible not to allow anyone to view other users' email addresses.

Closes T15443

Test Plan:
* As an admin, go to `/applications/view/PhabricatorDiffusionApplication/` and see new policy "Can Edit and View Identities" set to "All Users" (as implicitly before)
* As an admin, go to `/applications/view/PhabricatorDiffusionApplication/` and change "Can Edit and View Identities" from "All Users" to "Administrators"
* As a non-admin, go to `/diffusion/identity/` and try to select the disabled "Create Identity" button; get an error message clicking it due to lack of permissions
* Given there is at least one identity defined, as a non-admin, go directly to `/diffusion/identity/view/1/` and get "You do not have permission to view this object."
* Given there is at least one identity defined, as a non-admin, go directly to `/diffusion/identity/edit/1/` and get "You do not have permission to view this object."
* As a non-admin, go directly to `/diffusion/identity/edit/form/default/` and get "You do not have permission to edit this object."
* As a non-admin, go directly to `/diffusion/identity/` and get "No Identities found." instead of seeing the existing identities listed.
* As an admin, go to `/diffusion/identity/` and still see the existing identities listed.
* As an admin, go to `/diffusion/identity/`, select "Create Identity" to go to `/diffusion/identity/edit/` and see the "Create Identity" page (though broken; see T15453)
* As an admin, go to `/diffusion/identity/view/1/` and still see the existing identity.
* As an admin, go to `/diffusion/identity/edit/1/` and successfully edit the existing identity.

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

Reviewed By: O1 Blessed Committers, speck, valerio.bozzolan

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

Maniphest Tasks: T15443

Differential Revision: https://we.phorge.it/D25450
2023-11-11 13:27:11 +01:00
Zero King
c97a50472c Correct default database prefix in documentation
Summary: Default value of `storage.default-namespace` is still `phabricator`. Correct documentation about this.

Test Plan: Compare documentation with src/applications/config/option/PhabricatorMySQLConfigOptions.php.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25463
2023-11-11 10:32:55 +08:00
Andre Klapper
87e9c936ad Make "git cat-file" exception messages include repository monogram/slug
Summary:
When throwing an exception related to output provided by `git cat-file`, include the repository monogram to allow potentially debugging in Git.

Closes T15661

Test Plan:
Unclear. Basically: "have a broken Git repository in Diffusion".
(However this patch changes a message only shown in case of an exception, so in the worst case we'd break the exception via an exception.)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15661

Differential Revision: https://we.phorge.it/D25460
2023-11-10 11:40:04 +01:00
Waldir Pimenta
0729aa574b Remove mention of Phabricator in the Auth setup check
Summary:
The authentication setup check, available at <PHORGE_URL>/config/issue/auth.config-unlocked/,
contained a reference to Phabricator in the prompt of the command line hint to resolve the issue.
Similar checks only showed the prompt symbol, not the directory, so this one was changed to match.

Ref T15006

Test Plan:
- Run `./bin/auth unlock`
- Visit <PHORGE_URL>/config/issue/auth.config-unlocked/
- Notice that, with this patch, "phabricator" no longer appears in the prompt prefix
  for the suggested fix command at the end of the page.

Reviewers: O1 Blessed Committers, valerio.bozzolan, speck

Reviewed By: O1 Blessed Committers, valerio.bozzolan, speck

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

Maniphest Tasks: T15006

Differential Revision: https://we.phorge.it/D25425
2023-11-10 09:13:38 +00:00
Waldir Pimenta
8092d90c79 Adjust message in timezone conflict form
Summary:
This applies a suggestion initially proposed in
https://we.phorge.it/D25420#12264

Test Plan:
- Change your browser/system timezone to differ from your Phorge profile timezone
- Click the notice that Phorge shows at the bottom left about the timezone mismatch
- Confirm that the form text has been changed as per the diff in this revision

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25458
2023-11-10 09:03:30 +00:00
Valerio Bozzolan
8507d3a950 Fix Exception in Chat room when you are not a Participant
Summary:
After this change you can lurk in public chats, and receive notifications, without crashing your planet.

Fix exception "Undefined index: PHID-USER-..." shown to newcomers when they are receiving messages
from a public Chat they are not members of.

Closes T15497

Test Plan:
- Have the Notification server (Aphlict) enabled and running.
  https://we.phorge.it/book/phorge/article/notifications/
- Be user Alice and visit a Conpherence Room. Alice must be not a participant.
- Be user Bob and send a message in that Room.

Now Alice does not see a crash anymore, but the message from Bob.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15497

Differential Revision: https://we.phorge.it/D25408
2023-11-09 21:05:56 +01:00
Andre Klapper
dfa15726ea Fix cursor paging issue in Given Token query call
Summary:
The "Query" class for Given Token is missing a "withIDs()" method.

`Call to undefined method PhabricatorTokenGivenQuery::withIDs() at [PhabricatorCursorPagedPolicyAwareQuery.php:120]`

Closes T15652

Test Plan: Go to the Token page and pass a URL parameter, such as `/token/given/?after=3`

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15652

Differential Revision: https://we.phorge.it/D25455
2023-11-09 21:01:02 +01:00
Zero King
ce5e0f3e33 Fix doc link to Restarting Phorge
Summary: See Q81. Link to /diviner/find/ could not find the documentation because it was renamed to "Restarting Phorge".

Test Plan:
1. Uninstall optional PHP extension zip and restart Phorge
2. Vist /config/issue/ and click on a missing extension issue
3. Click on the documentation link to Restarting

Reviewers: O1 Blessed Committers, valerio.bozzolan, speck

Reviewed By: O1 Blessed Committers, valerio.bozzolan, speck

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

Differential Revision: https://we.phorge.it/D25459
2023-11-09 19:33:59 +08:00
roberto.urbani
37ecdf2336 Improving UX for ignoring timezone conflicts
Summary:
When there is a new timezone conflict, you will be able to ignore it with a checkbox.
Fix T15349

Preview:

{F343198}

Test Plan: Having a conflicting timezone, click the notification so the usual popup appears. There is a checkbox, leave it checked to ignore the current conflict, uncheck to manually resolve the conflict by selecting one of the available timezones.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15349

Differential Revision: https://we.phorge.it/D25420
2023-11-07 09:29:12 +01:00
Andre Klapper
887e344c19 Fix project page 404 after rename and removing new name from alias slugs
Summary:
When renaming a project to a slug already listed under Additional hashtags and explicitly also removing that to-become slug, accessing the project via the URL `/tag/projectname/` returned a 404 until someone added the current project name explicitly under "Additional hashtags" again.

In that case, do not remove the alternative hashtag to avoid the 404.

Closes T15636

Test Plan: See steps in https://we.phorge.it/T15636

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15636

Differential Revision: https://we.phorge.it/D25453
2023-11-05 13:18:15 +01:00
Andre Klapper
222a6fea0a Fix PHP 8.1 "strlen(null)" exception on Diffusion repo URIs page after repo creation
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.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/repository/storage/PhabricatorRepository.php:348]
```

Closes T15658

Test Plan: Create an empty new Git repository, go to its URIs management page.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15658

Differential Revision: https://we.phorge.it/D25454
2023-11-04 19:35:01 +01:00
Andre Klapper
d4b110af26 Remove unused variable $info in DiffusionCloneController.php
Summary:
Left-over from rPa6b550ba0394284441ee55d11e276a05eb568ad9

Closes T15655

Test Plan: Carefully read the source code file to look out for another appearance; after hours of fruitless searching get slightly disappointed.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15655

Differential Revision: https://we.phorge.it/D25451
2023-10-27 11:34:54 +02:00
Valerio Bozzolan
629fa368cb Calendar: fix creation of ICS Files
Summary:
It seems that, in an attempt to make ICS URI(s) editable, we broke the ability
to manually import ICS files. Whops.

The cause is, the URI needs to be put inside its dedicated import engine,
and not the general one.

Since the intention of T15137 was to be able to edit this field, we have done
that in the right way this time. So, you see the field, not just in creation mode.

Thanks to the kind aklapper for reporting.

Ref      T15137
Closes   T15619
Rollback 02a4f8b0c8

Test Plan:
- visit /calendar/import/ and:
- create/edit an ICS File Import (now works again)
- create/edit an ICS URI Import (still work)
- try looking at an "ICS Import page" as author (URI still visible)
- try looking at an "ICS Import page" without Edit permissions (URI still omitted correctly)

Reviewers: aklapper, O1 Blessed Committers, 20after4

Reviewed By: aklapper, O1 Blessed Committers, 20after4

Subscribers: 20after4, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15619, T15137

Differential Revision: https://we.phorge.it/D25448
2023-10-25 19:09:11 +02:00
sten
318d7a61fe Fix PhabricatorAuthCSRFEngine.php strncmp(null) PHP 8.1 error
Summary:
Update PhabricatorAuthCSRFEngine.php such that it doesn't fall over when provided with a null CSRF token under PHP 8.1

Fixes T15654

Test Plan: Do a POST request to phorge.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15654

Differential Revision: https://we.phorge.it/D25449
2023-10-25 11:03:39 +01:00
Andre Klapper
7b0021a03c Fix "Undefined index" exception setting Meme text
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) Undefined index: above at [<arcanist>/src/error/PhutilErrorHandler.php:251]
 arcanist(), phorge()
   #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phorge>/src/applications/macro/engine/PhabricatorMemeEngine.php:276]
```

Closes T15637

Test Plan:
Create a meme called "angrycat" from the /macro/ page, and try a comment like this, expecting no nuclear implosion:

    {meme, src=angrycat, below=}
    {meme, src=angrycat, above=}
    {meme, src=angrycat, below=, above=}
    {meme, src=angrycat, below=  , above=  }
    {meme, src=angrycat, below=asd}
    {meme, src=angrycat, above=asd}
    {meme, src=angrycat, above=asd, below=dsa}
    {meme, src=angrycat, above=   asd   , below=   dsa  }

Also carefully read the code with your big eyes, keeping in mind that strlen does not accept passing `null` in PHP 8, and looking at what we did in rPb4cfe56f03b44615ac9251aed8d74bf13b085051.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15637

Differential Revision: https://we.phorge.it/D25437
2023-10-24 09:58:36 +02:00
Valerio Bozzolan
2d635fb76e Dashboard Panel: fix first tab sometime not opened anymore
Summary:
After this change the first Tab ID is always selected, so we don't risk
to have no tabs opened by default under some corner cases.

This is vaguely better than the original logic that relied on the fact that
(0=="0") is true. Besides being a vaguely weird emoticon as well, now that
I look at it better.

Original logic:

https://we.phorge.it/source/phorge/browse/master/src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php;c43618a3a8bb021936fad687f04cb1a95faa23e4$289

This fixes a regression that appeared in the cute Wikimedia Phabricator
(that now is really Wikimedia Phorge). Their homepage should be gorgeous again,
without blank space due to unopened silly tabs.

Closes T15651

Test Plan:
- Have a Tab Panel (/dashboard/panel/).
- Be sure that the first Tab is automatically selected (again?)

Reviewers: aklapper, O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15651

Differential Revision: https://we.phorge.it/D25447
2023-10-16 08:44:45 +02:00
Valerio Bozzolan
f727f17bc2 Fix regression in DiffusionDiffQueryConduitAPIMethod
Summary:
Fix the following error you may encounter in production:

    Too few arguments to function DiffusionDiffQueryConduitAPIMethod::getDefaultParser(), 0 passed in /var/www/phorge/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php on line 156 and exactly 1 expected

It was caused by the lack of a new mandatory parameter in a method.

Closes T15649

Test Plan: Check with your big eyes that a ConduitAPIRequest is passed to getDefaultParser().

Reviewers: avivey, O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15649

Differential Revision: https://we.phorge.it/D25444
2023-10-10 07:16:15 +02:00
Andre Klapper
03afb97ff2 Correct Transaction text when changing Diffusion URI I/O type
Summary:
After changing the I/O type of a Diffusion repository URI, the transaction history incorrectly shows a message which talks about changing the URI's Display type instead.

Closes T15648

Test Plan: Change the I/O type of a Diffusion repo URI and look at that URIs history.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15648

Differential Revision: https://we.phorge.it/D25443
2023-09-28 09:19:55 +02:00
Valerio Bozzolan
903d71e67d Workboard: Milestone Name easily editable (instead of surfing 3 pages)
Summary:
After this change, a new input field "Milestone Name" appears in the "Edit" menu of a Milestone:

| Before    | After     |
|-----------|-----------|
| {F314008} | {F314005} |

So you can quickly change the name of your Milestones, from a Workboard.

Before this change, from a Workboard, this was the way to rename a Milestone:

1. click on the Milestone name (yes, that is a link)
2. click on Manage
3. click on Edit Details
4. rename
5. Save
6. Manually visit again the Project's Workboard

After this change, from a Workboard, you just need to:

1. click on Milestone > Edit
2. click on Edit Column
3. rename
4. Save

Example usage:

{F314015}

This does not change the level of permissions needed: if you have not enough
permissions to see or edit a Milestone, you cannot access this feature indeed.

In short, this is just a frontend change, keeping current policies as-is.

Closes T15143

Test Plan:
Create a Project or use an existing editable one.

Create a Milestone called "Test Milestone". You can create Milestones visiting the Project's menu {nav icon=sitemap,name=Subprojects > icon=plus,name=Create next milestone}

Visit the Project's Workboard. Find the column "Test Milestone". Click the Edit button on a Milestone, and:

- try to save another name: it must work
- try to save an empty name: nice error message shown
- try to save both the score points and the name: it must work
- try to save "FOO" as Points: you still see the error message

Also:

- do the same for the Backlog column: it still works (name still allowed to be empty)
- do the same for a "normal" Column (not the Backlog): it still work (name still __not__ allowed to be empty)

Reviewers: O1 Blessed Committers, Cigaryno, 20after4, waldyrious

Reviewed By: O1 Blessed Committers, Cigaryno, 20after4, waldyrious

Subscribers: waldyrious, brennen, aklapper, 20after4, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15143

Differential Revision: https://we.phorge.it/D25066
2023-09-25 08:17:51 +02:00
sten
91faf16cac Add documentation for cowsay
Summary:
Cowsay is great, but what if you want to talk like a koala?

This diff adds diviner documentation on how to use the additional templates in externals/cowsay/cows/

Test Plan:
  bin/diviner generate
	https://my.phorge.site/book/phorge/article/differential_cowsay/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25434
2023-09-20 10:21:24 +01:00
sten
a0fb344b94 Fix PHP 8.1 auth view strlen(null) error
Summary:
Trying to view a Jira auth provider from https://my.phorge.site/auth/ results in strlen(): Passing null to parameter #1 ($string) of type string is deprecated

This change fixes it

Fixes T15634

Test Plan:
Go to https://my.phorge.site/auth/ and have a Jira already setup.
Click on Jira auth provider
Confirm the page is displayed and no error is generated.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15634

Differential Revision: https://we.phorge.it/D25432
2023-09-11 11:57:35 +01:00
Andre Klapper
a65061ddc3 Fix PHP 8.1 "strlen(null)" exception rendering Task with empty custom date field
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=customOAuthUrlencodeNull, ref.master=df6c315ace5f, ref.customOAuthUrlencodeNull=c69b9749027f), phorge(head=master, ref.master=7868ab3754fa)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:14]
```

Closes T15632

Test Plan: Have a custom field with type=date defined in maniphest.custom-field-definitions and edit an existing Task changing something else, keeping that field as empty.

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15632

Differential Revision: https://we.phorge.it/D25431
2023-09-09 20:55:08 +02:00
sten
f7d9d95b79 Fix Diviner strlen(null) error when clicking on a link
Summary:
Fix issue whereby clicking on a link in Diviner (eg https://my.phorge.site/diviner/find/?name=Differential_User_Guide&type=article&jump=1) results in a strlen(null) error under PHP 8.1

Fixes T15635

Test Plan:
* Go into the Diviner differential page /book/phorge/article/differential/
* Click on the link to Differential User Guide: Inline Comments

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15635

Differential Revision: https://we.phorge.it/D25433
2023-09-06 12:23:42 +01:00
sten
1720209f16 Various PHP 8.1 strlen(null) fixes for Dashboard Panels
Summary:
In the dashboard application (https://my.phorge.site/dashboard/), when creating panels, adding panels to tab panels, and viewing query panels, we get a variety of strlen(null) errors under PHP 8.1.

This fixes all the ones seen.

Fixes T15574

Test Plan: See T15574

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15574

Differential Revision: https://we.phorge.it/D25367
2023-09-05 17:33:11 +01:00
Andre Klapper
7868ab3754 Make InterpreterBlockRule regex only match on valid interpreter names
Summary:
With this patch, the underlying exception described in T15372#8537 still remains. However, with this patch, the bug is more contained as it is not triggered when not calling an interpreter (`cowsay`, `figlet`), so Phorge does not crash rendering `noValidInterpreter {{{foo}}} bar` lines but renders them as is (for whatever reasons such lines may exist).

See T15372

Test Plan:
Enter strings into a comment:
* `invalid {{{saysay}}} foo` now renders as plain text instead of crashing
* `invalid (invalid) {{{saysay}}} foo` now renders as plain text instead of crashing
* `cowsay (invalid) {{{saysay}}} foo` will still crash as before

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25415
2023-09-04 13:12:11 +02:00
Benjamin Kausch
dc10a7e69e Implement ferret engine in typeahead datasource query for repos
Summary:
This broadens the typeahead datasource search for repos. Before this patch a repository named "Alligator Simulator" would not be found with the search string "simu...". This is patched with the ferret engine search and indexing features.

See T15583

Test Plan: Create repositories with titles with 2 or more words. Search for these repos with the global typeahead search. The search term should begin with the second/third/n-th word of the repo title.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15583

Differential Revision: https://we.phorge.it/D25430
2023-09-04 09:48:41 +02:00
Andre Klapper
cef12d8dc2 Fix PHP 8.1 "strlen(null)" exceptions editing a form when custom field of type Date exists
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_scalar()` as a replacement when both string and integers could be passed as a value like here.

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

Also fix similar warning for `ctype_digit(): Argument of type null will be interpreted as string in the future` by checking for `null` first.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=master, ref.master=bcfcd9acfc12)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:27]
```

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=customFieldDate, ref.master=bcfcd9acfc12, ref.customFieldDate=bcfcd9acfc12)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:35]
```

```
EXCEPTION: (RuntimeException) ctype_digit(): Argument of type null will be interpreted as string in the future at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=customFieldDate, ref.master=bcfcd9acfc12, ref.customFieldDate=bcfcd9acfc12)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> ctype_digit(NULL) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:77]
```

Closes T15601

Test Plan: After applying these three changes and creating a custom field with `"type": "date"` under `/config/edit/maniphest.custom-field-definitions/`, the website `/transactions/editengine/maniphest.task/view/5/` renders correctly in the browser, showing "This is a preview of the current form configuration."

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15601

Differential Revision: https://we.phorge.it/D25389
2023-09-02 11:16:36 +02:00
Andre Klapper
68c687affd Fix call to undefined method PhutilJSON::encodeAsObject()
Summary:
Replace call to undefined method `PhutilJSON::encodeAsObject()` with existing `PhutilJSON::encodeFormatted()`

```
EXCEPTION: (Error) Call to undefined method PhutilJSON::encodeAsObject() at [<phabricator>/src/applications/transactions/xaction/PhabricatorEditEngineDefaultTransaction.php:68]
```

Closes T15603

Test Plan: Grep and read the code in https://we.phorge.it/source/arcanist/browse/master/src/parser/PhutilJSON.php

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15603

Differential Revision: https://we.phorge.it/D25391
2023-09-02 11:13:06 +02:00
Aviv Eyal
69c64c1e83 Teach Commit View about Encoding
Summary:
If the user specifies a text encoding via the "View Options" dropdown, respect this choice.
Ref Q68.

Test Plan: Play with the Encoding button in the view

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25360
2023-08-31 11:00:11 -07:00
Aviv Eyal
94c0774d80 log deprecation events in Dark Console
Summary:
`PhutilErrorHandler` already defines "DEPRECATED" error class, but it's not used.
I plan to use it to report deprecation warnings.

With this change, they will be shown in the Dark Console and in the error logs

Ref T15554

This change on its own won't do anything, but is safe to land first.

Test Plan: With D25387, pages that have deprecation warnings are now shown, and the deprecation message is available in the dark console (and in log).

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15554

Differential Revision: https://we.phorge.it/D25386
2023-08-31 08:18:28 -07:00
Aviv Eyal
aeab4efe17 Generate Diviner book for Javelin
Summary: And also fix a bug in the generator script.

Test Plan: Run `bin/diviner generate`, wait till the cows come home, see 3 pages about Javelin in the Diviner app.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25429
2023-08-30 11:20:12 -07:00
Nicolas Aragone
4c314a733c Clarifying the operating system choices.
Test Plan: looked at words, words looked good

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #documentation

Differential Revision: https://we.phorge.it/D25427
2023-08-29 20:15:08 -03:00
Andre Klapper
beec08e019 Fix RuntimeException: min(): Array must contain at least one element
Summary:
Make sure that `$epochs[]` is never empty but contains `0` so `min($epochs)` will not complain.

Closes T15623

Test Plan: Carefully read the code (as I am unaware of reproduction steps).

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15623

Differential Revision: https://we.phorge.it/D25417
2023-08-22 18:31:27 +02:00
Andre Klapper
9b105c8e9e Fix PHP 8.1 "strlen(null)" exceptions importing ICS file into calendar
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=df6c315ace5f), phorge(head=importICSCalendar, ref.master=3cc5ee6a33df, ref.importICSCalendar=3bd396120123)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/calendar/import/PhabricatorCalendarImportEngine.php:459]
```

```
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=df6c315ace5f), phorge(head=importICSCalendar, ref.master=3cc5ee6a33df, ref.importICSCalendar=3bd396120123)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/calendar/import/PhabricatorCalendarImportEngine.php:450]
```

Closes T15620

Test Plan:
* Revert rP02a4f8b0c8f1279fc0040ad8077942fd8b0d948b not to run into T15619
* Try to import an ICS file via `/calendar/import/edit/`
* See that page `/calendar/import/4/` renders correctly in web browser and shows `Log Messages` and `Imported Events` as expected

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15620

Differential Revision: https://we.phorge.it/D25411
2023-08-19 10:09:49 +02:00
Aviv Eyal
ba4b8cb1ae PHP 8 and Diviner Technical Documentation
Summary:
This also fixes the field Personal Settings > Display Preferences > Monospaced Font, when empty.

Close T15621

Test Plan: Generate diviner stuff, navigate to the "Technical Documentation" section (In php 8.1+)

Reviewers: O1 Blessed Committers, mturdus, valerio.bozzolan

Reviewed By: O1 Blessed Committers, mturdus, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15621

Differential Revision: https://we.phorge.it/D25412
2023-08-18 15:38:16 -07:00
Valerio Bozzolan
3cc5ee6a33 Documentation: fix unexisting path sshd_config.phabricator.example
Summary:
Since the example file was renamed, this change makes the documentation consistent with it.

Also we added exactly one-space somewhere, to create a super-satisfying indentation an example block. You're welcome.

Ref T15006

Test Plan: Check that the documentation is at least 0.000001% better now.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15006

Differential Revision: https://we.phorge.it/D25410
2023-08-19 00:02:39 +08:00
bob
8876f75fbb Fix a PHP 8.1 deprecated use of strlen with a NULL argument
Summary:
This call is preventing users to browse Subversion repositories.
Using strlen() to check string validity 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.

Fix T15608

Test Plan:
- Sign in
- Open a Diffusion SVN repository
- You should see the repository instead of getting a Runtime Exception

Reviewers: O1 Blessed Committers, Sten, avivey

Reviewed By: O1 Blessed Committers, Sten, avivey

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

Maniphest Tasks: T15608

Differential Revision: https://we.phorge.it/D25398
2023-08-18 15:50:29 +02:00
bob
6ec89e9f08 Fix a PHP 8.1 deprecated use of strlen with a NULL argument
Summary:
With PHP 8.1+ it was not possible to view a commit from subversion repositories.
Indeed, if the commit user and/or email is not properly defined, strlen(null) is called, causing a deprecation warning, elevated to exception.
Using strlen() to check string validity 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.

Fix T15609

Test Plan:
- Apply D25397 and D25398
- Sign in
- Open a diffusion SVN repository
- Open a commit without user name and or email
- You should not see the same Runtime Exception (unfortunately, there is another one as described in T15610)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15609

Differential Revision: https://we.phorge.it/D25399
2023-08-18 12:48:18 +02:00
Aviv Eyal
ad0052fcd6 Rebrand: Add "path" entries to PlatformSymbols
Summary: Ref T15006. Change a few places that were mentioning `phabricator` path.

Test Plan: Mk1 eyeball on each effected page.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15006

Differential Revision: https://we.phorge.it/D25343
2023-08-18 02:00:41 -07:00
Andre Klapper
7c58ea1403 Fix PHP 8.1 "strlen(null)" exception creating a Phriction doc without slug in Conduit
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=df6c315ace5f), phorge(head=master, ref.master=7cffe557ac24)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php:28]
```

Closes T15614

Test Plan: Create a Phriction document without slug via Conduit. Get an `EXCEPTION: (Exception) No such document.` instead of a `strlen()` exception.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15614

Differential Revision: https://we.phorge.it/D25406
2023-08-18 09:50:19 +02:00
Andre Klapper
d84dbf8e27 Fix PHP 8.1 "strlen(null)" exception creating a Paste without content in Conduit paste.create
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=df6c315ace5f), phorge(head=thisThis, ref.master=7cffe557ac24, ref.thisThis=529790613a86)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php:46]
```

Closes T15613

Test Plan: Create a paste in the deprecated API paste.create without content via Conduit. Shows `error_code ERR-NO-PASTE` as expected, and no exception.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15613

Differential Revision: https://we.phorge.it/D25405
2023-08-18 09:48:41 +02:00
bob
0ef08baf64 Fix a PHP 8.1 deprecated use of strlen with a NULL argument
Summary:
This strlen() call was preventing a new Phorge instance to be deployed/configured.
Indeed, on a fresh instance, configuration's "base-uri" key may not be defined witch lead to a Runtime Exception.
Using strlen() to check string validity 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.

Fix T15605

Test Plan:
- Checkout a fresh Phorge local copy from official 'https://we.phorge.it/source/phorge.git'
- Install/Configure local webserver/database
- Open http://phorge.domain in you browser
- Configure Phorge database (as requested by webpage)
- Create Phorge database (as requested by webpage)
- You should be able to reach administrator account page instead of getting a RuntimeException

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15605

Differential Revision: https://we.phorge.it/D25394
2023-08-18 09:20:36 +02:00
bob
7f46a252f2 Fix a PHP 8.1/8.2 deprecated use of strlen a NULL argument
Summary: This commit harmonizes PhabricatorNotificationServerRef's getURI and getWebsocketURI methods as discussed in D25382.

Test Plan: This is hard to say since I didn't know how/when this function might be called.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25401
2023-08-18 09:20:03 +02:00
Andre Klapper
3a1f568974 Fix typo "this this server"
Summary: Closes T15611

Test Plan: Carefully read.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15611

Differential Revision: https://we.phorge.it/D25404
2023-08-17 17:46:11 +02:00
bob
747d7db241 Fix a PHP 8.1/8.2 deprecated use of ltrim and rtrim with a NULL argument
Summary:
These calls were preventing notification servers configuration to be properly initialized.
Indeed, PHP 8.X is stricter concerning
This behavior is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Fix T15598

Test Plan:
Sign in as an administrator, configure the notification server without filling admin path field,
you shouldn't get both an RuntimeException and a warning indicating that Phorge is unable to connect
to Notification Server but a message indicating that everything is fine.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15598

Differential Revision: https://we.phorge.it/D25382
2023-08-17 10:41:37 +02:00
bob
a5d8b2d5cf Fix a PHP 8.1 deprecated use of preg_match with a NULL argument
Summary:
These calls are preventing users to browse subversion/mercurial repositories in PHP 8.1+.
Indeed, a similar bug affecting git repositories was already addressed in another commit
(rP6b8ec50148909938850b5acfd11725ae23a8e31b). This commit harmonize both DiffusionSvnRequest
and DiffusionMercurialRequest with DiffusionGitRequest

Fix T15607

Test Plan:
- Sign in
- Open a diffusion SVN/Mercurial repository
- You should not get a RuntimeException concerning this preg_match call

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan

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

Maniphest Tasks: T15607

Differential Revision: https://we.phorge.it/D25397
2023-08-17 10:16:50 +02:00
Andre Klapper
9fa9aa30b9 Fix PHP 8.1 "strlen(null)" exception on "Link External Account" page at login
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(), phorge()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/controller/PhabricatorAuthSetExternalController.php:43]
```

Closes T15606

Test Plan: Follow steps in T15606; page `/auth/external/` displays as expected the content: "Link External Account - You can link your Phabricator account to an external account to allow you to log in more easily in the future. To continue, choose an account to link below. If you prefer not to link your account, you can skip this step." and the "Link External Account" button.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15606

Differential Revision: https://we.phorge.it/D25395
2023-08-16 15:04:18 +02:00
Andre Klapper
29493f8a5c Fix PHP 8.1 "strlen(null)" exception listing >100 task search results
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=df6c315ace5f), phorge(head=master, ref.master=7040bd525764)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/maniphest/query/ManiphestTaskQuery.php:1039]
```

Closes T15604

Test Plan: Have more than 100 tasks, run a broad search with more than 100 results, try to go to next page of results.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15604

Differential Revision: https://we.phorge.it/D25392
2023-08-16 10:58:08 +02:00
Andre Klapper
7040bd5257 Fix PHP 8.1 "strlen(null)" exception adding "Build with Buildkite" build step in Harbormaster
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=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=master, ref.master=226f3150933d)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php:271]
```

Closes T15594

Test Plan: Add a build step in Harbormaster, select "Interacting with External Build Systems > Build with Buildkite" at `/harbormaster/step/new/1/HarbormasterBuildkiteBuildStepImplementation/`, select the "Create Build Step" button. Page now shows several expected error messages (API Token is required; Organization Name is required; etc) instead of a PHP error.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15594

Differential Revision: https://we.phorge.it/D25379
2023-08-15 10:15:32 +02:00
Aviv Eyal
bcfcd9acfc Unify type-checking for setHref() type methods
Summary:
Adopt `PhutilURI::checkHrefType()` to unify type-check of some PHUI objects.

Ref T15316. Depends on D25356.

Test Plan: In production.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15316

Differential Revision: https://we.phorge.it/D25357
2023-08-12 08:39:13 -07:00
Steve Campbell
e8ea7a4a36 Fix PHP 8.1 issue in DifferentialChangeset getOldStatePathVector()
Summary:
The DifferentialChangeset getOldStatePathVector() method assumes oldFile and filename are set.
This worked under PHP <= 8.0, but fails for PHP >= 8.1 with error messsage

```
strlen(): Passing null to parameter #1 ($string) of type string is deprecated
```

Fixes T15517

Test Plan:
Create a diff in which a new file is added.
This file will have oldFile NULL and filename a string.
View the diff https://my.phorge.site/D1234

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15517

Differential Revision: https://we.phorge.it/D25323
2023-08-12 08:39:36 +01:00
Andre Klapper
98dfac53ba Fix PHP 8.1 "strlen(null)" exceptions blocking account registration with custom OAuth provider after redirect
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(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/provider/PhabricatorOAuth1AuthProvider.php:70]
```

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/view/PhabricatorAuthAccountView.php:32]
```

Closes T15590

Test Plan:
* As an admin, set up custom "MediaWiki" OAuth provider from from https://gitlab.wikimedia.org/-/ide/project/repos/phabricator/extensions/edit/wmf/stable/-/src/oauth/
* As an admin, apply D25373
* As a user, go to `/auth/login/mediawiki:whatever/`
* Select login button
* Allow authentication on third-party site
* Get redirected to Phorge instance
Phorge user account registration page "Create a New Account" at `/auth/register/abcdefghijklmnopqrstuvwxyz0123456/` now renders as expected, instead of displaying errors only.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15590

Differential Revision: https://we.phorge.it/D25375
2023-08-11 21:03:02 +02:00
Andre Klapper
a2e8ab3180 Fix PHP 8.1 "strlen(null)" exception adding a "Drydock: Run Command" build step in Harbormaster
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=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=master, ref.master=226f3150933d)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/harbormaster/controller/HarbormasterStepEditController.php:142]
```

Closes T15592

Test Plan: Add a build step for an existing Harbormaster Build Plan, see that page `New Step: Drydock: Run Command` is correctly rendered at `/harbormaster/step/new/1/HarbormasterDrydockCommandBuildStepImplementation/`

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15592

Differential Revision: https://we.phorge.it/D25377
2023-08-11 21:01:39 +02:00
Andre Klapper
c61c6a1ec3 Fix PHP 8.1 "strlen(null)" exception adding a Harbormaster Build Plan
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=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=master, ref.master=226f3150933d)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/harbormaster/editor/HarbormasterBuildPlanEditEngine.php:106]
```

Closes T15591

Test Plan: Visit `/harbormaster/plan/edit/form/default/`. "Create Build Plan" page renders as expected.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15591

Differential Revision: https://we.phorge.it/D25376
2023-08-11 21:00:46 +02:00
Andre Klapper
085769ceb6 Fix PHP 8.1 "strlen(null)" exceptions trying to authenticate via custom OAuth provider
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.

This change also replaces two other `strlen()` calls, only based on //reading// the code but not based on triggering exceptions.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:121]
```

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(), ava(), phorge(), wmf-ext-misc()
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/applications/auth/adapter/PhutilOAuth1AuthAdapter.php:125]
```

Closes T15588

Test Plan: Go to `/auth/login/mediawiki:whatever/` and at least see no `strlen()` errors anymore (while further issues remain). See T15588 for details.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15588

Differential Revision: https://we.phorge.it/D25373
2023-08-11 20:57:51 +02:00
Andre Klapper
10ee019785 Fix PHP 8.1 "strlen(null)" exception setting Passphrase Credential
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=788098096e11), phorge(head=master, ref.master=840a7fab2bc8)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/passphrase/view/PassphraseCredentialControl.php:53]
```

Closes T15580

Test Plan: Set URI for a Diffusion Repository, select URI and select "Set Credential". Page "Edit Repository URI" at `/diffusion/123/uri/edit/456/` renders as expected in web browser.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15580

Differential Revision: https://we.phorge.it/D25370
2023-08-11 20:56:49 +02:00
Aviv Eyal
eb0bb17368 Replace dedicated Commit Field with an existing one
Summary: fix T15600

Test Plan: arc diff against this

Reviewers: Sten, O1 Blessed Committers!

Reviewed By: Sten

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

Maniphest Tasks: T15600

Differential Revision: https://we.phorge.it/D25385
2023-08-11 11:42:50 -07:00
sten
8310591523 Fix DifferentialDiff getFieldValuesForConduit PHP 8.1 strlen(null) errors
Summary:
Fix DifferentialDiff getFieldValuesForConduit PHP 8.1 strlen(null) errors by replacing the strlen() calls with phutil_nonempty_string().

Also needed to update DifferentialDiffTestCase.php to being a PhabricatorTestCase, as it was throwing an exception prior to any code changes -
```
EXCEPTION (Exception): Trying to read configuration "policy.locked" before configuration has been initialized.
```

Fixes T15529

Test Plan: arc diff

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15529

Differential Revision: https://we.phorge.it/D25333
2023-08-11 10:40:11 +01:00
Steve Campbell
4b3c384856 Fix DifferentialCommitMessageField renderFieldValue PHP 8.1 strlen(null) error
Summary:
arc diff throws strlen(null) error from DifferentialCommitMessageField renderFieldValue when calling a Phorge server running PHP 8.1

Add unit test, which required a new DifferentialTestCommitMessageField class so as to be able to test the abstract DifferentialCommitMessageField class methods.

Fixes T15530

Test Plan:
Make a change in a git repo with remote a Phorge server running PHP 8.1
Run:

```
arc diff
```
See exception thrown as per T15530

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15530

Differential Revision: https://we.phorge.it/D25334
2023-08-11 10:38:20 +01:00
Steve Campbell
9c8b9a6bbf Fix PHP 8.1 trim(null) exception in ./bin/diviner generate
Summary:
When running './bin/diviner generate' under PHP 8.1, we get a trim(null) exception.

Fixes T15548

Test Plan: Run './bin/diviner generate'

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15548

Differential Revision: https://we.phorge.it/D25353
2023-08-11 10:37:31 +01:00
bob
eb2be08f9f Fix PHP 8.1/8.2 "strlen(null)" exception in SearchController
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.

EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261];
PHP message: arcanist(head=master, ref.master=6e4947b55f09), phorge(head=master, ref.master=7bebfa289aa1);
PHP message:   #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/search/controller/PhabricatorSearchController.php:16];

Fix T15595

Test Plan: Search something using the main search bar. It should return something (or not) instead to throwing a RuntimeException.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15595

Differential Revision: https://we.phorge.it/D25380
2023-08-10 17:42:17 +02:00
root
2da7594344 Fix a PHP 8.1/8.2 deprecated call to strlen with a NULL argument
Summary:
This call was preventing notification servers configuration to be properly initialized.
Indeed, 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.

Fix T15596

Test Plan:
Sign in as an administrator, configure the notification server without filling admin path field,
you shouldn't get an invalid configuration error

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15596

Differential Revision: https://we.phorge.it/D25381
2023-08-10 17:36:35 +02:00
Andre Klapper
226f315093 Fix PHP 8.1 "strlen(null)" exception creating Blueprint Working Copy
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, however use `phutil_nonempty_scalar()` as the value might not necessarily be a string object.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_scalar() 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=788098096e11), phorge(head=arcpatch-D25239, ref.master=840a7fab2bc8, ref.arcpatch-D25239=870d62ce0ed9)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php:36]
```

Closes T15581

Test Plan:
Page `Create Blueprint` at `/drydock/blueprint/edit/form/default/` renders as expected in web browser.

Try also creating a custom integer field and put some fuzzy data.

https://we.phorge.it/book/phorge/article/custom_fields/

Test these values:

- 1 (stays as-is)
- 0 (stays as-is)
- 123.45 (becomes 123)
- a "lizard" (becomes zero)
- empty ("") (becomes empty)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15581

Differential Revision: https://we.phorge.it/D25371
2023-08-05 23:29:12 +02:00
Andre Klapper
39b576b145 Add HTML header for Atom/RSS discovery on Phame blog pages
Summary:
Allow easier discovery and subscribing to Atom feeds of Phame blogs.

To be extra cautious, also make sure that the added line is a `PhutilSafeHTML`.

Original author: @20after4

Closes T15550

Test Plan: Go to `/phame/blog/view/1/` and check the HTML source code. See an additional `<link>` item with `type="application/atom+xml"` in the `<head>` section.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, 20after4, Cigaryno

Maniphest Tasks: T15550

Differential Revision: https://we.phorge.it/D25346
2023-08-05 23:26:34 +02:00
Andre Klapper
9fe2bfebe8 Fix PHP 8.1 "strlen(null)" exception adding LDAP authentication
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=788098096e11), phorge(head=master, ref.master=840a7fab2bc8)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php:430]
```

Closes T15587

Test Plan: Go to `/auth/config/edit/?provider=PhabricatorLDAPAuthProvider` and see that "Add Auth Provider: LDAP" page is rendered.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15587

Differential Revision: https://we.phorge.it/D25372
2023-08-04 18:06:13 +02:00
Valerio Bozzolan
840a7fab2b Hide Archived Panels from Dashboards
Summary:
In edit mode, Archived Panels are shown differently,
with content text in grey and with the usual red tag.

In view mode, Archived Panels are just not rendered.

This makes it easier to design Dashboards with individual
components that can be de-activated and re-activated on the fly.

Closes T15366.

{F325637}

Test Plan:
Have a Dashboard somewhere (e.g in your homepage).

Visit a Panel (W-ID) and Archive it.

See that now the Panel is not shown anymore on the Dashboard.

Edit the Dashboard and you see the Panel again as "Archived".

Anything around is just normal.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15366

Differential Revision: https://we.phorge.it/D25368
2023-08-01 09:51:18 +02:00
Benjamin Kausch
df3ac50cb7 Implements a more informative hovercard for wiki documents
Summary:
The current hovercard of a wiki document has no further information except the title. This commit adds object type, project tags, parent documents, last author and last edited time to the card.

Preview:

{F313614}

Preview in a pessimistic case:

{F325478}

Closes T15433

Test Plan: Edit a wiki document with/without project tags and parent documents and see the hovercard in the feed.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey, Cigaryno

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey, Cigaryno

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

Maniphest Tasks: T15433

Differential Revision: https://we.phorge.it/D25303
2023-07-31 17:33:36 +02:00
sten
4cedb928aa Fix arc patch PHP 8.1 strlen(null) error
Summary:
Fix arc patch PHP 8.1 strlen(null) error.

When doing an 'arc patch Dxxxx' against a diff on a PHP 8.1 Phorge server we get a strlen(null) error.
Updating the idx call to provide a default empty string resolves it.
Providing a default empty string to

Fixes T15571

Test Plan: arc patch Dxxxx

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15571

Differential Revision: https://we.phorge.it/D25364
2023-07-29 17:36:13 +01:00
sten
007e7621f2 Fix HarbormasterBuildUnitMessage PHP 8.1 strlen(null) error
Summary:
Fix HarbormasterBuildUnitMessage PHP 8.1 strlen(null) error.

Fixes T15572

Test Plan: Do an 'arc diff' to a PHP 8.1 Phorge server when doing so will trigger unit tests.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15572

Differential Revision: https://we.phorge.it/D25365
2023-07-29 13:04:11 +01:00
sten
1802ebd2cc Fix PHP 8.1 Diffusion history errors
Summary:
Fix multiple PHP 8.1 errors when viewing Diffusion history.

Fixes T15573

Test Plan: View a diffusion history page. Eg https://my.php81.phorge.site/source/myrepo/history/master/

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15573

Differential Revision: https://we.phorge.it/D25366
2023-07-29 13:03:48 +01:00
c7574226
189a5d6047 Fix strlen(null) PHP 8.1 error when pushing into a fresh repository
Summary:
Doing a git push into a fresh repository over https fails with a PHP 8.1 strlen(null) error.

This fixes it.

Fixes T15569

Test Plan:
* Create an empty repository on a PHP 8.1 Phorge instance
* Clone it
* Add some data
* git push

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15569

Differential Revision: https://we.phorge.it/D25361
2023-07-28 18:22:55 +01:00
Valerio Bozzolan
1aa532a476 Workboard Columns: avoid page reload on Edit > Cancel
Summary:
The rationale for this change is that reloading a page unnecessarily wastes
resources that we can save.

This includes human resources (time) but also computational resources
as well. We probably save a fawn for every 1,000 clicks on that button.
A message to Greta Thunberg: now Phorge is with you.

This is the involved "Cancel" button, that does not reload the page anymore:

{F309894}

Closes T15471

Test Plan:
Workboard > Column > Edit > Cancel:

The popup closes gracefully instead of a page refresh.

Also try opening the workflow in another tab (/project/board/1/hide/2/) > Cancel:

You turn back to your Workboard just as before.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15471

Differential Revision: https://we.phorge.it/D25302
2023-07-28 19:02:40 +02:00
Valerio Bozzolan
1e3c9bdfee Update Diff: fix dead-end when not yours
Summary:
Fix "Update Patch" for generic Differential revisions.

You can now help a coworker to update their patch, from the web.

So, if you visit Diff 111 (not yours) and you click "Update Diff", and you paste a valid diff,
you arrive here:

    https://we.phorge.it/differential/diff/222/?revisionID=111

That page as default was suggesting some Diffs that are yours. Plus, now it shows Diff 111.

Omitting the Diff from which the workflow was started made no sense and it's certainly an oversight.

Any follow-up change is welcome to modernize the selector using AphrontFormTokenizerControl.

Closes T15538

Test Plan:
- create a Diff on Differential with user A
- click on Update Diff from user B (pasting a valid diff) and Continue

Now that patch is selected (and selectable). No dead-end anymore.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15538

Differential Revision: https://we.phorge.it/D25337
2023-07-25 14:15:03 +02:00
Aviv Eyal
bf025c5fb4 Aphlict - search for default config in the right place
Summary: Fix T15502.

Test Plan: Renamed `phorge` dir few times, run `./bin/aphlict status` to see message.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15502

Differential Revision: https://we.phorge.it/D25344
2023-07-24 00:42:06 -07:00
Valerio Bozzolan
0f07c07b3b Attach Diff to Revision: fix Repository asked twice
Summary:
If you manually upload a Diff (patch) from the Differential web
interface you can select the Repository.

We fix the default value of the Repository field during creation mode,
guessing the repo from the potentially already-available diff.

Closes T15537

Test Plan:
- Create a cute Differential Revision from web
- Pick a Repository > Continue
- Create a new Revision > Continue

At this point you should still have that repository instead of nothing.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15537

Differential Revision: https://we.phorge.it/D25338
2023-07-22 13:55:41 +02:00
Steve Campbell
cb9fcf18d5 Fix PHP 8.1 "strlen(null)" exception trying to stop maintenance mode of Diffusion repo
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.

Use `isset` instead to check if the argument "start" was passed to the CLI command.

```
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=97e163187418), phorge(head=repoMaintStartHistory, ref.master=1c098c273d06, ref.repoMaintStartHistory=0a4a34143528)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php:45]
```

Closes T15476

Test Plan: After applying this change, executing `./bin/repository maintenance --stop R1` on the CLI shows `Took repository "R1" out of maintenance mode.` as expected, instead of an exception.

Reviewers: O1 Blessed Committers, valerio.bozzolan, aklapper, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15476

Differential Revision: https://we.phorge.it/D25296
2023-07-18 09:06:25 +01:00
Steve Campbell
27fa498966 Fix PHP 8.1 strlen(null) error in PhabricatorFile::newChunkedFile()
Summary:
Fix PHP 8.1 strlen(null) error in PhabricatorFile::newChunkedFile().

Fixes T15499

Test Plan:
Added a unit test which replicated the fault, so you can test simply by 'arc unit'
Alternatively, see test in T15499

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15499

Differential Revision: https://we.phorge.it/D25352
2023-07-17 14:24:41 +01:00
Steve Campbell
dbc101ca8a Fix PHP 8.1 substr(null) in People > Activity Logs
Summary:
When someone tries to log on with invalid credentials, a record is inserted in the phabricator_user.user_log table with action = login-fail.
The session value of this record is set to null in this case.

When you open the People → Activity Logs screen, you will see an exception because of this.

Fixes T15555

Test Plan: Go to https://my.phorge.site/people/logs/ after a login failure and a login success.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15555

Differential Revision: https://we.phorge.it/D25351
2023-07-17 14:23:30 +01:00
Steve Campbell
849e18ccbb Fix PhabricatorRepository generateURI PHP 8.1 strlen(null) errors
Summary:
When viewing a repository in Diffusion, clicking on a folder (eg https://my.phorge.site/source/myrepo/browse/master/myfolder/) will generate multiple strlen(null) exceptions under PHP 8.1

Fix is to replace all the strlen() calls with phutil_nonempty_string()

Fixes T15532

Test Plan: View a folder in a repo in Diffusion. Eg https://my.phorge.site/source/myrepo/browse/master/myfolder/

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15532

Differential Revision: https://we.phorge.it/D25336
2023-07-17 11:07:25 +01:00
Steve Campbell
8af1624692 Fix passing null to trim() error in DiffusionBrowseTableView render()
Summary:
When viewing the top level of a diffusion repository, $request->getPath() returns null, which then causes trim() to throw an error.

Fix is to update DiffusionRequest getPath() such that it returns '' instead of null, thus fixing it's return type.

Fixes T15522

Test Plan: Go to https://my.phorge.site/source/myrepo

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15522

Differential Revision: https://we.phorge.it/D25329
2023-07-17 11:05:18 +01:00
Steve Campbell
65e57fe23d Fix PHP 8.1 PhabricatorEditorURIEngine::newForViewer() trim(NULL) error
Summary:
Under PHP 8.1, PhabricatorEditorURIEngine::newForViewer() is throwing a trim(NULL) error when trying to view a diff.
This is because it tries to apply string operations to a user setting which will be null by default.

Fixes T15518

Test Plan:
Unit test added -
  arc unit

Or just view a diff. Eg:
	https://my.phorge.site/D1234

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, avivey

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

Maniphest Tasks: T15518

Differential Revision: https://we.phorge.it/D25324
2023-07-17 11:03:52 +01:00
Steve Campbell
8cbbc9f961 Fix strlen(null) in DifferentialChangesetViewController loadCoverage()
Summary:
DifferentialChangesetViewController loadCoverage() fails under PHP 8.1 when test coverage is provided for some but not all modified files.

Update the code to replace strlen() with phutil_nonempty_string().

Fixes T15521

Test Plan: View a diff with test coverage for some but not all files.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15521

Differential Revision: https://we.phorge.it/D25328
2023-07-17 11:02:38 +01:00
Steve Campbell
f7dd8f579a Fix /dashboard/adjust/remove/ PHP 8.1 strlen(null) errors
Summary:
/dashboard/adjust/remove/ POST requests fail under PHP 8.1 with strlen(null) errors.

This change fixes it.

Fixes T15549

Test Plan:
View a dashboard which has some panels. Eg https://my.phorge.site/dashboard/view/1/
Click on a 'Manage Panel' dropdown and click on 'Remove Panel'

Confirm the panel is removed and no strlen(null) errors are generated.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15549

Differential Revision: https://we.phorge.it/D25345
2023-07-15 12:43:52 +01:00
Steve Campbell
3703588e9d Fix PHP 8.1 strlen(null) in DiffusionView linkBrowse()
Summary:
Fix PHP 8.1 strlen(null) in DiffusionView linkBrowse().

Fixes T15542

Test Plan:
# Go into a diff (eg https://my.phorge.site/D1234)
# Click on the Revision Contents - History tab
# Click on a base link (the short git revision ID)

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15542

Differential Revision: https://we.phorge.it/D25340
2023-07-12 13:38:23 +01:00
Valerio Bozzolan
7bebfa289a Diffusion commits: add some edge phrases about Revisions
Summary:
This change implements some messages that were only present
from this class:

    DifferentialRevisionHasCommitEdgeType.php

But not in its inverse class:

    DiffusionCommitHasRevisionEdgeType.php

In short:

| Before    | After     |
|-----------|-----------|
| {F313282} | {F313281} |

Closes T15314

Test Plan:
Visit a Diffusion commit and use the sidebar menu "Edit Related Objects" to:

- add 1 revision
- add 2 revisions
- remove 1 revision
- remove 2 revisions
- add 1 revision, remove 1 revision
- add 2 revisions, remove 2 revisions

Check that you don't see phrases like "added an edge" anymore.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15314

Differential Revision: https://we.phorge.it/D25306
2023-07-06 13:32:21 +02:00
Valerio Bozzolan
92861cc1f0 Dashboard Tabs: fix action "Move Right"
Summary:
It seems that if you use the "Move Right" action, you can get
an unrelated error message about "Move Left":

    This is already the first tab. It can not move any farther to the left.

This happened because there was an incomplete condition.

Closes T15493

Test Plan:
- visit /dashboard/panel/ and create at least two panels (please, owned by you)
- visit a Dashboard, and add a Tabs Panel
- take the first Tab: "Move Right"

After this change, "Move Right" now always works.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15493

Differential Revision: https://we.phorge.it/D25307
2023-07-06 13:31:32 +02:00
Valerio Bozzolan
cae1246359 Dashboard Tabs: render "Move" buttons grayed out more consistently
Summary:
If you happen to create a Dashboard by retrieving other people's panels,
you were probably affected by this visual bug.

It seems that you cannot Move things, but you really can (and that is OK).

The reason is, to move things in a Parent Panel, you only need edit permission there,
and you do not need to also have edit permissions on every Child Panel.

Closes T15492

Test Plan:
- From user A:
    - Create two panels - editable by: User A
- From user B:
    - Create a "Tabs Panel" in a Dashboard
    - Attach the panels from User A (so, editable by, not you)

The meaningful "Move" actions should be not disabled anymore.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15492

Differential Revision: https://we.phorge.it/D25308
2023-07-06 13:31:14 +02:00
Steve Campbell
b3ac5ceb38 Fix DifferentialGetCommitMessageConduitAPIMethod execute strlen(null)
Summary:
When iterating through the fields of a differential commit, the DifferentialGetCommitMessageConduitAPIMethod execute method explicitly allows a value to be either a string or a null. It then calls strlen upon this possibly null value.

We could replace the strlen with phutil_nonempty_string, but as the code has already eliminated variable types other than string or null, it is more efficient to explicitly check for null or ''
```
$value === null or $value == ''
```

Fixes T15527

Test Plan:
Run
```
arc diff
```

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15527

Differential Revision: https://we.phorge.it/D25332
2023-07-06 09:42:20 +01:00
Aviv Eyal
d5a28e12a0 Project Hovercards: Show Description
Summary: Fixes T15275.

Test Plan:
Project pages have "Developer > View Hovercard" button. Or hover over a project handle, I guess.

Also test for empty description and with the description field disabled.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15275

Differential Revision: https://we.phorge.it/D25331
2023-07-05 13:31:55 -07:00
Andre Klapper
71f38a90a3 Fix PHP 8.1 "strlen(null)" exception on History page of Diffusion repo after setting maintenance mode
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=97e163187418), phorge(head=master, ref.master=1c098c273d06)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryMaintenanceTransaction.php:28]
```

Closes T15475

Test Plan:
Play a bit with maintenance messages:

    ./bin/repository maintenance --start "Start"      R1
    ./bin/repository maintenance --start "Start Yeah" R1
    ./bin/repository maintenance --stop               R1

Then visit `/diffusion/1/manage/history/` and look at `Diffusion put this repository into maintenance mode.` as expected, instead of an exception.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15475

Differential Revision: https://we.phorge.it/D25295
2023-07-05 19:41:51 +02:00
Andre Klapper
f45d6421a1 Fix PHP 8.1 "strlen(null)" exception opening a File overlay (Lightbox comment frame)
Summary:
The error was caused by the overlay lightbox, since it gives the possibility to share a comment on any file
in any general Remarkup text, but that comment textarea is indeed empty as default.

`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=97e163187418), phorge(head=T15498, ref.master=a25af8ccef69, ref.T15498=a25af8ccef69)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/files/controller/PhabricatorFileLightboxController.php:23]
```

Closes T15498

Test Plan: Visit a blog post with a file/image dropped in the content and click on the thumbnail. No error overlay dialog is displayed anymore.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15498

Differential Revision: https://we.phorge.it/D25310
2023-07-05 19:38:44 +02:00
Steve Campbell
9d512595c0 Fix PHP 8.1 DifferentialBranchField getBranchDescription strlen(null) error
Summary:
Fix PHP 8.1 strlen(null) error in DifferentialBranchField getBranchDescription()

Fixes T15531

Test Plan:
Simply viewing a diff (eg https://my.phorge.site/D1234) on a PHP 8.1 server generated the error fixed by this diff.

Also created a unit test.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15531

Differential Revision: https://we.phorge.it/D25335
2023-07-05 16:06:26 +01:00
Steve Campbell
9bf5e17352 PHP8.1 fix for DiffusionServeController serveRequest()
Summary:
When a 'git pull' is done to an https git URL, the $_SERVER variables PHP_AUTH_USER and PHP_AUTH_PW will be unset, causing PHP 8.1 to throw strlen(null) errors.

This update fixes the issue by defaulting the values to '', which results in $have_user and $have_pass having false values as desired.

Fixes T15520

Test Plan: arc unit

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15520

Differential Revision: https://we.phorge.it/D25327
2023-07-05 15:37:45 +01:00
Steve Campbell
5e48e16f77 Update DiffusionDocumentRenderingEngine to cope with null code coverage in PHP 8.1
Summary:
Update DiffusionDocumentRenderingEngine to cope with null code coverage in PHP 8.1

Fixes T15523

Test Plan: https://my.phorge.site/source/myrepo/browse/master/myfile

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15523

Differential Revision: https://we.phorge.it/D25330
2023-07-05 08:44:24 +01:00
Valerio Bozzolan
80484b76a5 Remarkup Code-block: parse language specifier in markdown
Summary:
We add support to code blocks with the language expressed as GitLab/GitHub/StackOverflow/...
"flavored markdown".

So we support this syntax: (to avoid confusion see it online on the Diff)

    lang=text
    ```php
    $asd = 1;
    ```

Before this change, this was the only supposed syntax in Remarkup, with an explicit "lang=":

    lang=text
    ```lang=php
    $asd = 1;
    ```

This change introduces a minor risk to eat legitimate Remarkup content, since Remarkup allows
to do a multi-line in this way:

    lang=text
    ```$asd = 1;
    $asd = 2;```

The above example still works, but, there is a chance that hardcore Remarkup people
have a problem when doing a code block to mention programming languages.

In short, this can be problematic since "cpp" will be eaten from this list:

    COUNTEREXAMPLE
    ```cpp
    php
    python
    ```

Using the above example is not socially nice because it is not usable in GitLab, GitHub and Stack Overflow.

If your first line is eaten:

Just *add* a newline on the top to reach a valid raw Markdown list (suggested, valid in Remarkup + Markdown):

    lang=text
    ```
    cpp
    php
    python
    ```

Or, just add "text" to specify that as language (suggested, valid in Remarkup + Markdown):

    lang=text
    ```text
    cpp
    php
    python
    ```

Or, just *remove* a newline from the bottom to reach a valid raw Remarkup list (Remarkup-only):

    lang=text
    ```cpp
    php
    python```

Or, just specify that you are writing in the language "text" (Remarkup-only):

    lang=text
    ```lang=text
    cpp
    php
    python```

To reduce impact and help you, the logic of this strict implementation is:

- must have backticks
- must not have any valid remarkup option, like lang=, counterexample, etc.
- must not have content in the same line of the last backticks
- must have a known language in our proposed subset

If everything is OK, we remove that language from the content since it would be otherwise displayed.

Interestingly, this could improve performance when rendering README files or snippets from external
websites, since - in case - we do not need to guess the language using our deep dark magic.

Closes T15481

Test Plan:
We added some nice unit tests. Ensure that this test passes:

    PhutilRemarkupEngineTestCase::testEngine

Optionally, take vision of these, before and after:

https://we.phorge.it/P16

Change the test plan slightly every time, to make sure it is not in your cache.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15481

Differential Revision: https://we.phorge.it/D25299
2023-07-04 18:23:14 +02:00
Aviv Eyal
603cf474ee Fix int fields for now
Summary: Fix T15516

Test Plan: Viewed an "int" custom field, no boom.

Reviewers: speck, valerio.bozzolan, O1 Blessed Committers

Reviewed By: valerio.bozzolan, O1 Blessed Committers

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15516

Differential Revision: https://we.phorge.it/D25325
2023-07-04 02:26:46 -07:00
Aviv Eyal
d725ffaa77 Fix "Register with Approval flow" for php 8
Summary: Ref T15064.

Test Plan:
- Register as a new user
- as admin, view user's page and approve it
- As new user, hit "wait patiently" to go back to Home

No crashes in this flow.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

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

Maniphest Tasks: T15064

Differential Revision: https://we.phorge.it/D25317
2023-07-02 08:49:12 -07:00
Aviv Eyal
9aafbb42ef fix strlen in PhabricatorMailManagementShowOutboundWorkflow
Summary: Ref T15064

Test Plan: run `./bin/mail show-outbound --id 1` on a non-html email with php 8.1, no crash.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Tags: #php_8_support

Maniphest Tasks: T15064

Differential Revision: https://we.phorge.it/D25275
2023-07-02 08:49:02 -07:00
MacFan4000
aebd7a2f72 Update a couple of lingering instances of secure.phabricator.com to we.phorge.it
Summary: We were still pointint to secure.phabricator.com in a couple places. This fixes that.

Test Plan: No testing needed

Reviewers: O1 Blessed Committers, speck, Cigaryno

Reviewed By: O1 Blessed Committers, speck, Cigaryno

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

Differential Revision: https://we.phorge.it/D25316
2023-06-30 12:01:54 -04:00
Steve Campbell
73253489bf Make src/infrastructure/javelin/markup.php phabricator_form PHP 8.1 compliant
Summary:
src/infrastructure/javelin/markup.php phabricator_form() performs a strcasecmp() operation on an optional attribute withoiut checking to see if it exists first. This causes an 'Passing null to parameter #1 ($string1) of type string is deprecated' error.

Because we subsequenly check to see that the value equals /POST/i, all we need to do is check that the value has some 'true' value before doing the strcasecmp(). If it's not true, then it won't be POST!

Fixes T15509

Test Plan: View a diff. Eg: https://my.phorge.site/D1234

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15509

Differential Revision: https://we.phorge.it/D25319
2023-06-30 15:13:20 +01:00
Steve Campbell
101ce834b8 Fix PHP 8.1 strlen() error when database replication Seconds_Behind_Master is NULL
Summary:
When MySQL database replication is configured, but not running, the slave status Seconds_Behind_Master is NULL.
When this value is passed to strlen() an error is thrown.

Fixes T15507

Test Plan:
* Configure database replication such that Seconds_Behind_Master is NULL
* Restart php-fpm
* Go to Phorge web site.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

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

Maniphest Tasks: T15507

Differential Revision: https://we.phorge.it/D25318
2023-06-30 13:49:32 +01:00
Taavi Väänänen
0a17287e08
Generalize references to PHP 5.x Debian/Ubuntu packages
Summary:
Both Debian and Ubuntu have been shipping PHP 7.x (or now 8.x) for a while.
This patch replaces the versioned php5-foo package references with more general
php-foo package names.

Test Plan: Navigated to the documentation pages that this patch updates.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25315
2023-06-29 15:58:54 +03:00
Valerio Bozzolan
8ffa604462 Diviner: mention how to flag Arcanist and Phorge as "safe" git repos
Summary:
This tip is useful if you are affected by the following error in git or similar:

    fatal: detected dubious ownership in repository at '/var/www/phorge'

Just follow the new tip from Diviner to fix at system level.

Ref T15282

Test Plan:
- see if you like the documentation tip
- try to execute the command, and verify that your computer does not explode
- eventually visit the /config/ page with and without that change (with and without a /etc/gitconfig)

Reviewers: O1 Blessed Committers, avivey, Cigaryno

Reviewed By: O1 Blessed Committers, avivey, Cigaryno

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15282

Differential Revision: https://we.phorge.it/D25236
2023-06-28 23:14:31 +02:00
Valerio Bozzolan
1005e38160 Fix notification message when Aphlict is not configured
Summary:
Before this change the footer in the notification bar was a bit
weird on the message "Notification server not enabled":

| Before    | After     |
|-----------|-----------|
| {F315024} | {F315001} |

Also a bit wrong on the "Connecting..." message:

| Before    | After     |
|-----------|-----------|
| {F315061} | {F315072} |

The fix involves a refactor in the HTML structure in order to
match the graphic rendered when Aphlict is configured and running.

In short, we pass from this:

    COUNTEREXAMPLE
    <span class="connection-status-text aphlict-connection-status-notenabled">
      <span class="visual-only phui-icon-view phui-font-fa fa-circle-o grey"></span>
      Notification server not enabled
    </span>

To this:

    <span class="visual-only phui-icon-view phui-font-fa fa-circle-o grey"></span>
    <span class="connection-status-text aphlict-connection-status-notenabled">Notification server not enabled</span>

See the Task for additional details.

Closes T15415

Test Plan:
Follow the official Notification documentation about the config `notification.servers`,
open the Notification top-bar, and check the message in these conditions:

- without the config
- with the config
- with/without Aphlict running

https://we.phorge.it/book/phorge/article/notifications/

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15415

Differential Revision: https://we.phorge.it/D25312
2023-06-27 13:30:11 +02:00
Valerio Bozzolan
659e13fa6d Fix UX regression in Dashboard Tabs Panel
Summary:
Before this change, it seems that the Dashboard Tabs Panel could be empty
as default. This was the regression:

cbc0e66154

The variable $is_selected was defined inside a foreach loop, but that loop
was terminated when it was then read again. This redefines that variable in
the right scope.

| Before    | After     |
|-----------|-----------|
| {F312797} | {F312798} |

Closes T15474

Test Plan: - see that now you have something visibile in your Dashboard Tabs Panel

Reviewers: speck, O1 Blessed Committers

Reviewed By: speck, O1 Blessed Committers

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15474, T15146

Differential Revision: https://we.phorge.it/D25291
2023-06-27 08:15:16 +02:00
Andre Klapper
e4fe54edf0 Fix typo "recipeint" in metamta.one-mail-per-recipient description
Test Plan: Go to `/config/settings/all` and look at the description of `metamta.one-mail-per-recipient`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25311
2023-06-26 14:28:01 +02:00
Valerio Bozzolan
a25af8ccef Diviner: add a minimal systemd example
Summary:
After this change the section "Managing Daemons with phd"
mentions a minimally viable systemd configuration file
to make systemd-users happier and systemd-haters saddest.

Closes T15467

Test Plan: - read the page, see systemd, don't cry

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: 20after4, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15467

Differential Revision: https://we.phorge.it/D25293
2023-06-23 08:50:16 +02:00
Andre Klapper
7c1487e4dc Fix Pholio RuntimeException: Undefined variable $dictionary (when adding an empty Inline Comment)
Summary:
Trying to create an empty inline comment in a Pholio mock, `$dictionary` does not get set as both `strlen($v_content)` and `$inline->getID()` are not true.

Thus show a more explanatory error message ('Comment cannot be empty.') to users instead of exposing internal variable names.

```
EXCEPTION: (RuntimeException) Undefined variable $dictionary at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=master, ref.master=980293b707a0)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/pholio/controller/PholioInlineController.php:117]
```

Closes T15456

Test Plan: After applying this change, try to add an empty Inline Comment in a Pholio mock. See that the error message is now "Comment cannot be empty." instead of "Undefined variable $dictionary".

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15456

Differential Revision: https://we.phorge.it/D25281
2023-06-19 14:13:36 +02:00
Andre Klapper
1c59b65421 Dashboards: add capability who can create Dashboards
Summary:
Add a `dashboard.create` capability to allow limiting dashboard creation (and creation of related panels).
This can reduce spam in open Phorge installations in which anyone can create an account while you still want anyone to be able to view existing dashboards.

Closes T15438

Test Plan:
1. As an admin, go to `/applications/view/PhabricatorDashboardApplication/`
2. See only two options "Can Use Application: All Users" and "Can Configure Application: Administrators"
3. Apply patch
4. As an admin, go to `/applications/view/PhabricatorDashboardApplication/` and see the new option "Can Create Dashboards" set to "All Users"
5. As an average user, go to `/dashboard/` and successfully create a new Dashboard
6. As an admin, go to `/applications/edit/PhabricatorDashboardApplication/` and change "Can Create Dashboards" from "All Users" to "Administrators", select "Save Policies" button
7. As an average user, go to `/dashboard/` and see that "Create Dashboard" is disabled
8. As an average user, go to an existing dashboard not created by this user and see that selecting "Edit Dashboard" shows "You do not have permission to edit this object."
9. As an average user, go to the existing dashboard that you created yourself and see that the Edit Policy is set to this user.
10. As an average user, go to the existing dashboard that you created yourself and see that you can still create or add panels.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15438

Differential Revision: https://we.phorge.it/D25270
2023-06-19 12:12:22 +02:00
Mukunda Modell
327ac921c2 Conduit column.search: add status, sequence and isDefault to API results
Summary:
This seems like a fairly obvious oversight with the column.search API.

Knowing:

1. isHidden - boolean to indicate Active vs Archived
2. isDefaultColumn - the one that Tasks get dropped in by default, usually called "Backlog"
3. sequence - numerical order on the Workboard

are all necessary for a lot of things that very sensible real-world API clients need to do when working with columns.

Partial cherry-pick from:

https://phabricator.wikimedia.org/rPHABebfe30890b52784d222ec4ed36c05462b2a57f92

Closes T15484

Test Plan:
Tested on phabricator.wikimedia.org over many months and used by real client apps.

To do additional tests, visit this page:

/conduit/method/project.column.search/

Check that the new fields are returned correctly and nothing explodes.

Reviewers: #blessed_committers, O1 Blessed Committers, 0, avivey, valerio.bozzolan

Reviewed By: #blessed_committers, O1 Blessed Committers, 0, valerio.bozzolan

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

Maniphest Tasks: T15081, T15484

Differential Revision: https://we.phorge.it/D25038
2023-06-19 08:58:52 +02:00
Andre Klapper
478012cd46 Add serious business string for defrocking a user (remove admin rights)
Summary:
Allow humans to understand what happened when `phabricator.serious-business` mode is enabled: The administrator role was removed from a user account.

Closes T15480

Test Plan: Enable `phabricator.serious-business` mode. Enable and disable an account as admin. Check that account's feed and the general feed.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15480

Differential Revision: https://we.phorge.it/D25298
2023-06-16 13:58:28 +02:00
Valerio Bozzolan
7fe622e5d3 Auto-subscription: little less verbose
Summary:
When the user "Mrs. Kitten" adds or remove "Mrs. Kitten" as Subscriber,
usually these messages were generated:

    Mrs. Kitten added a subscriber: Mrs. Kitten.
    Mrs. Kitten removed a subscriber: Mrs. Kitten.

This was a bit like the Spiderman meme self-pointing Spiderman.

After this change, these beautiful messages are generated instead:

    Mrs. Kitten subscribed.
    Mrs. Kitten unsubscribed.

| Before    | After     |
| {F286215} | {F286216} |

Closes T15347

Test Plan:
- subscribe on something
- unsubscribe from something
- all other cases remain as-is

Reviewers: O1 Blessed Committers, bfs, speck

Reviewed By: O1 Blessed Committers, bfs, speck

Subscribers: bfs, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15347

Differential Revision: https://we.phorge.it/D25191
2023-06-15 11:52:02 +02:00
Andre Klapper
1c098c273d Fix PHP 8.1 "strlen(null)" exception calling Conduit's user.whoami
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=97e163187418), phorge(head=master, ref.master=7bbd657c19c4)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/conduit/controller/PhabricatorConduitAPIController.php:686]
```

Closes T15469

Test Plan: After applying this change, `/api/user.whoami` correctly renders the "Method Call Result"

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15469

Differential Revision: https://we.phorge.it/D25292
2023-06-13 07:31:52 +02:00
Andre Klapper
7bbd657c19 Fix PHP 8.1 "strlen(null)" exception when Diffusion repository has no tags
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=diffusionEmptyRepoPatternSearch, ref.master=97e163187418, ref.diffusionEmptyRepoPatternSearch=97e163187418), phorge(head=master, ref.master=108cbcd09bd3)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionTagListController.php:28]
```

Closes T15461

Test Plan: After applying this line, get the expected `CommandException: Command failed with error #128!` due to ` fatal: detected dubious ownership in repository at '/var/repo/1'` (plus a `RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated` as a bonus), instead of the previous RuntimeException about `strlen()`.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15461

Differential Revision: https://we.phorge.it/D25285
2023-06-12 21:50:35 +02:00
Andre Klapper
54ee51d7ab Work around exception in Herald transcript of old tasks: Call to a member function getAppliedTransactionPHIDs() on bool
Summary:
In some cases, older Herald transcripts which got garbage collected display an exception.
For unknown reasons, calling `getObjectTranscript()` on the HeraldTranscript object `$xscript` can return a bool with the value `false`.
Afterwards, calling `getAppliedTransactionPHIDs()` on that bool throws an exception.
Thus as a workaround, return an empty array instead in this case, like the code already does when $xscript->getObjectTranscript()->getAppliedTransactionPHIDs() === null.

Note that it remains unclear whether/when the bool may have the value `true` hence this situation is not covered by this code change (the code would still throw an exception in this situation).

Closes T15343

Test Plan:
1. Change system time to one year back (or optionally, use `./phorge/bin/garbage set-policy --collector herald.transcripts --days 1`, drop steps 9 and 10, and wait a day before performing step 11)
2. As an admin, go to http://phorge.localhost/herald/create/
3. Select "Maniphest Tasks"
4. On http://phorge.localhost/herald/create/?adapter=HeraldManiphestTaskAdapter , select "Global Rule"
5. Under "Conditions", select `any of` and set the three conditions `Description | contains | Internet Archive`, `Description | contains | archive.org`, `Description | contains | Wayback Machine`.
6. Under "Action", select `Add projects | someProject`
7. Select "Save Rule"
8. Trigger the rule by creating a new task.
9. Change system time back to today
10. On the shell, run `./phorge/bin/phd restart`
11. Visit created task and select "View Herald Transcript"
12. Transcript page displays "Old Transcript - Details of this transcript have been garbage collected." and shows no exception anymore

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15343

Differential Revision: https://we.phorge.it/D25246
2023-06-12 21:49:14 +02:00
Andre Klapper
3f8846d80c Fix PHP 8.1 "strlen(null)" exception on Diffusion repository History page after setting Callsign
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=97e163187418), phorge(head=diffusionCallsignHistory, ref.master=9b99123ff931, ref.diffusionCallsignHistory=9b99123ff931)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryCallsignTransaction.php:28]
```

Closes T15465

Test Plan: After applying this change, `/diffusion/XYZ/manage/history/` renders correctly and shows `user set the callsign for this repository to XYZ.`

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15465

Differential Revision: https://we.phorge.it/D25289
2023-06-12 21:47:45 +02:00
Andre Klapper
1060736e89 Fix some icons not displayed on UIExamples' "Icons and Images" (PHUIIconExample) page
Summary:
Fix three typos in icon names

Closes T15454

Test Plan: Go to `/uiexample/view/PHUIIconExample/` before and after applying the change; compare icons displayed for `fa-codiepie`, `fa-user-o`, `fa-thermometer-0`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15454

Differential Revision: https://we.phorge.it/D25280
2023-06-12 17:29:20 +02:00
Andre Klapper
efbb809d42 Fix PHP 8.1 "strlen(null)" exception which blocks rendering commit page in Diffusion
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=97e163187418), phorge(head=diffusionCallsignHistory, ref.master=9b99123ff931, ref.diffusionCallsignHistory=d5fb6702a49a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionCommitController.php:31]
```

Closes T15466

Test Plan: After applying this change, going to an existing commit URL like `/diffusion/XYZ/commit/999a2c7d1ff8` shows the exception covered by T15464 instead, as expected.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15466

Differential Revision: https://we.phorge.it/D25290
2023-06-12 11:21:33 +02:00
Andre Klapper
32b2d3871f Fix PHP 8.1 "strlen(null)" exceptions trying to browse Diffusion repository code
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=97e163187418), phorge(head=diffusionBrowseCode, ref.master=108cbcd09bd3, ref.diffusionBrowseCode=108cbcd09bd3)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionBrowseController.php:25]
```

```
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=97e163187418), phorge(head=diffusionBrowseCode, ref.master=108cbcd09bd3, ref.diffusionBrowseCode=108cbcd09bd3)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php:40]
```
Closes T15462

Test Plan: After applying these two changes, get next expected exceptions about `RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated` and `CommandException: Command failed with error #128!  fatal: detected dubious ownership in repository at '/var/repo/1'`, but no RuntimeException about `strlen()` anymore.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15462

Differential Revision: https://we.phorge.it/D25286
2023-06-12 03:50:12 +02:00
Andre Klapper
db19b23dce Fix PHP 8.1 "strlen(null)" exceptions on History page of Diffusion repo after changing text encoding
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=97e163187418), phorge(head=master, ref.master=108cbcd09bd3)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryEncodingTransaction.php:20]
```

Closes T15460

Test Plan: After applying these two changes, changing the text encoding of a Diffusion repository to a valid encoding and going to `/diffusion/1/manage/history/`, page renders correctly and shows no exception.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15460

Differential Revision: https://we.phorge.it/D25284
2023-06-12 03:49:34 +02:00
Andre Klapper
331b9cca42 Fix PHP 8.1 "strlen(null)" exception rendering a commit in Diffusion when bugtraq.url = null
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=97e163187418), phorge(head=diffusionBrowseCommit, ref.master=9b99123ff931, ref.diffusionBrowseCommit=9b99123ff931)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionCommitController.php:925]
```

Closes T15464

Test Plan: After applying this change, selecting the last commit on http://phorge.localhost/diffusion/query/all/ correctly renders the commit page (e.g. `/R1:1234567890abcdef1234567890abcdef12345678`)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15464

Differential Revision: https://we.phorge.it/D25288
2023-06-12 03:37:14 +02:00
Andre Klapper
9b99123ff9 Fix PHP 8.1 "strlen(null)" exceptions trying to browse Diffusion repository history
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=97e163187418), phorge(head=diffusionBrowseCode, ref.master=108cbcd09bd3, ref.diffusionBrowseCode=015ffef14b0c)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php:50]
```

```
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=97e163187418), phorge(head=diffusionBrowseCode, ref.master=108cbcd09bd3, ref.diffusionBrowseCode=015ffef14b0c)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php:50]
```

Closes T15463

Test Plan: After applying these two changes, get next expected exceptions about `RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated` and `CommandException: Command failed with error #128!  fatal: detected dubious ownership in repository at '/var/repo/1'`, but no RuntimeException about `strlen()` anymore.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15463

Differential Revision: https://we.phorge.it/D25287
2023-06-12 02:51:20 +02:00
Andre Klapper
108cbcd09b Fix PHP 8.1 "base64_decode(null)" exception calling Conduit's file.upload with no data passed
Summary:
Since PHP 8.1, `base64_decode()` does not accept passing null as a parameter. Thus first check that `data !== null` before calling `decodeBase64($data)` (which then calls PHP's `base64_decode()`), and throw an exception if it is.

```
EXCEPTION: (RuntimeException) base64_decode(): 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=conduitDashboardPanelEdit, ref.master=0d81da590923, ref.conduitDashboardPanelEdit=ab4391b30465)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> base64_decode(NULL, boolean) called at [<phorge>/src/applications/files/conduit/FileConduitAPIMethod.php:84]
```

Closes T15426

Test Plan: Applied this change; afterwards `/api/file.upload` under "Method Result", "error_info" shows "Unable to decode base64 data!" instead of "base64_decode(): Passing null to parameter #1 ($string) of type string is deprecated" which is more descriptive.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15426

Differential Revision: https://we.phorge.it/D25258
2023-06-11 16:34:16 +02:00
Andre Klapper
7b57ba2b98 Fix PHP 8.1 "strlen(null)" exception initializing Diffusion repository without path access permissions
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.

Closes T15459

Test Plan: After applying this change, going to `/diffusion/17/manage/`, the actual error (`cannot mkdir /var/repo/17: Permission denied`) is propagated and displayed in the "Working Copy Status" section, instead of being hidden by a `strlen()` exception. See T15459 for details.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15459

Differential Revision: https://we.phorge.it/D25283
2023-06-10 22:59:57 +02:00
Andre Klapper
c553692d45 Fix PHP 8.1 "strlen(null)" exception which blocks rendering errors on Create Blueprint page
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=e4fd31ec024e), phorge(head=D25240, ref.master=b1edfea09bad, ref.D25240=b1edfea09bad)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php:392]
```
Closes T15413

Test Plan:
Applied this change on top of D25239. Afterwards, the "Create Blueprint" page on `/drydock/blueprint/edit/form/default/` after pressing the "Create Blueprint" button the page correctly renders the expected error that some fields cannot be empty.

# Enter a commit message.
#
# Changes:
#
#     src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php

Also, try to create extra numeric fields (like in the User application) and try to send zero or 1 using Conduit `user.edit`.

Reviewers: O1 Blessed Committers, valerio.bozzolan, speck

Reviewed By: O1 Blessed Committers, valerio.bozzolan, speck

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

Maniphest Tasks: T15413

Differential Revision: https://we.phorge.it/D25240
2023-06-10 22:58:28 +02:00
Andre Klapper
b4cfe56f03 Fix PHP 8.1 "ltrim(null)" exception which blocks rendering first Meme comment
Summary:
Since PHP 8.1, passing a null string to `ltrim(string $string)` is deprecated.

Thus first check if After and Below text are not null before trimming.

Closes T15379

Test Plan:
Applied this change; afterwards several times created a new Pholio mock and added a Meme comment. I could not reproduce the problem anymore (first meme comment in a mock always rendered correctly instead of showing an exception as comment). However, I could not reliably reproduce the problem anyway.

- Create a meme without any above/below text
- Create a meme with just spaces as above/below text
- Create a meme with just above text as "asd", or "0" or a lizard
- Create a meme with just below text as "asd", or "0" or a lizard
- Create a meme with both above and below texts with "asd", "0" and a lizard and more stuff (doing all 64 combinations)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15379

Differential Revision: https://we.phorge.it/D25212
2023-06-10 18:41:00 +02:00
Andre Klapper
76ef9db8a5 Fix PHP 8.1 "strlen(null)" exception about Staging URI on Diffusion repo History page
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
Passing null to strlen() is deprecated since PHP 8.1. Thus first check that the string is not null.

```
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=b325304b6e52), phorge(head=master, ref.master=83edbffd521d)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryStagingURITransaction.php:20]
```
This is quite similar to D25277.

Closes T15458

Test Plan: After applying this change, editing the Staging URI by saving its already empty value, and going to the repo History page, the page `/diffusion/1/manage/history/` renders without an exception, showing `R1` being Inactive and `user set as the staging area for this repository.` [sic!]

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15458

Differential Revision: https://we.phorge.it/D25282
2023-06-10 18:34:42 +02:00
Andre Klapper
bab9970740 Fix PHP 8.1 "trim(null)" exception which blocks rendering Conduit's harbormaster.sendmessage page
Summary:
Since PHP 8.1, passing a null string to `trim()` is deprecated.
Thus first check that `$content` is not null before trimming it.

Also since trim() returns a string and never null, we can also simplify the non-empty check,
in a more readable and efficient way, avoiding strlen() that was usually used for other "more wild" cases.

```
EXCEPTION: (RuntimeException) trim(): 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=master, ref.master=0d81da590923)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> trim(NULL) called at [<phorge>/src/infrastructure/markup/blockrule/PhutilRemarkupTableBlockRule.php:117]
```

Closes T15427

Test Plan: Applied this change, afterwards `/conduit/method/harbormaster.sendmessage/` correctly rendered in web browser.

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

Reviewed By: O1 Blessed Committers, speck, valerio.bozzolan

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

Maniphest Tasks: T15427

Differential Revision: https://we.phorge.it/D25259
2023-06-10 16:26:49 +02:00
Valerio Bozzolan
83edbffd52 Config page: add lovely git-related error messages in standard error log
Summary:
Premise: the Config page runs git commands. Spoiler: they can fail.

Before this change errors were just suppressed and ignored.

After this change you get at least a log line. Also, you get a tip for a very specific well-known error affecting recent git.

Probably suppressing stuff was fine in the moment git worked here. But nowadays
git doesn't work so easily here, since it introduced very weird additional
configurations in order for a repository to be indicated as "safe" or not.

Error suppression was a problem there, because understanding the error with
"future objects" is not trivial for most users. Really.

After this change, these errors are beautifully mentioned in the standard log
of your webserver, to the best of our communication ability.

This is a cute example of a new log line:

    Cannot identify the version of the phorge repository because the webserver does not trust it (more info on Task https://we.phorge.it/T15282).
    Try this system resolution:
    sudo git config --system --add safe.directory /var/www/phorge

Another:

    Cannot identify the version of the phorge repository because the webserver does not trust it (more info on Task https://we.phorge.it/T15282).
    Try this system resolution:
    sudo git config --system --add safe.directory /var/www/arcanist

Incidentally, these specific errors probably afflict your Phorge/Phabricator, and now
you have some useful resolution tips. You are welcome!

You can also join T15282 to discuss your specific case.

Closes T15243

Test Plan:
- visit the `/config/` page: does it worked before? it still works now
- visit the `/config/` page without `/etc/gitconfig`: you may still see "Unknown" as version - but, you finally get something in the log (instead of nothing)
- visit the `/config/` page after following your log messages: now you should see the library versions! yeeh

Additional tests:

- manually sabotage the command "git log" replacing with "gitfooolog" and visit /config page: see the unexpected 'gitfooolog command not found' log line
- manually sabotage the command "git remove" replacing with "gitremotelog" and visit /config/ page: see the unexpected 'gitremotelog command not found' log line

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, deadalnix, aklapper, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15243

Differential Revision: https://we.phorge.it/D25148
2023-06-10 13:21:41 +02:00
Andre Klapper
7af82abcb9 PHP 8.1 "strlen(null)" exception on SVN History page after changing "Import Only"
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=b325304b6e52), phorge(head=master, ref.master=cb938d869c3f)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositorySVNSubpathTransaction.php:25]
```

Closes T15445

Test Plan: After applying this change, and after setting some "Import Only" value for a new Subversion repository, the page `/diffusion/1/manage/history/` renders showing `R1` being Inactive and `user set the repository "Import Only" path to main`.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15445

Differential Revision: https://we.phorge.it/D25277
2023-06-08 14:53:44 +02:00
Andre Klapper
b09471d557 Fix PHP 8.1 "strlen(null)" exceptions creating a Diffusion Identity without entering assignee
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=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryIdentityAssignTransaction.php:55]
```

```
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=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:298]
```

```
EXCEPTION: (RuntimeException) mb_detect_encoding(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=diffusionCreateIdentity, ref.master=cbc0e661544a, ref.diffusionCreateIdentity=cbc0e661544a)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> mb_detect_encoding(NULL, array) called at [<phorge>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:313]
```

Closes T15440

Test Plan: After applying these three changes, going to `/diffusion/identity/edit/form/default/` and selecting the "Create Identity" button will only show a AphrontQueryException unrelated to PHP 8 and covered in T15439 instead.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15440

Differential Revision: https://we.phorge.it/D25271
2023-06-08 14:52:26 +02:00
Andre Klapper
9aa88ae0d7 Fix PHP 8.1 "strlen(null)" exception on History page of Diffusion repo after renaming default branch
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=arcpatch-D25250, ref.master=18554ea76ceb, ref.arcpatch-D25250=fade4603a799), phorge(head=master, ref.master=e11c5486c92b)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/xaction/PhabricatorRepositoryDefaultBranchTransaction.php:25]
```

Closes T15434

Test Plan: After applying this change, after changing the name of the (previously empty) default branch of a Diffusion repository, and then going to the repository History at `/diffusion/<someID>/manage/history/`, the page renders correctly in the web browser instead of showing an exception.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15434

Differential Revision: https://we.phorge.it/D25265
2023-06-08 14:50:43 +02:00
Andre Klapper
25c4f6224d Fix some PHP 8.1 "strlen(null)" exceptions on Differential Revision page
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=diff3, ref.master=e11c5486c92b, ref.diff3=e11c5486c92b)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/differential/customfield/DifferentialBranchField.php:42]
```

Closes T15432

Test Plan: After applying these three changes (on top of D25262 and D25263), there is no `strlen()` related exception displayed on `/D1/` anymore, however there are further exceptions to be sorted out in other tasks.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15432

Differential Revision: https://we.phorge.it/D25264
2023-06-08 14:49:28 +02:00
Andre Klapper
44a8a1c408 Fix PHP 8.1 "preg_match(null)" exception on "Create Revision" page in Differential when not entering data
Summary:
`preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1.

Thus add a `phutil_nonempty_string()` check if the `$subject` parameter is a non-empty string.

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) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=18554ea76ceb), phorge(head=diffAttach, ref.master=e11c5486c92b, ref.diffAttach=e11c5486c92b)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> preg_match(string, NULL, NULL) called at [<phorge>/src/applications/differential/editor/DifferentialTransactionEditor.php:221]
```

Closes T15431

Test Plan: After applying this change on top of D25262, going to `/differential/diff/create/`, creating a diff,  and entering nothing on the "Create Revision" page on `/differential/revision/attach/1/to/` correctly shows the errors "You must provide a test plan. Describe the actions you performed to verify the behavior of this change. Revisions must have a title." in web browser instead of an exception.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15431

Differential Revision: https://we.phorge.it/D25263
2023-06-08 14:48:45 +02:00
Andre Klapper
b3894bc2c6 Fix PHP 8.1 "strlen(null)" exception viewing branches of non-existing Hg repo
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=b325304b6e52), phorge(head=HgViewBranches, ref.master=cb938d869c3f, ref.HgViewBranches=cb938d869c3f)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php:83]
```

Closes T15447

Test Plan: After applying this change, going to `/diffusion/1/branches/default/` shows an expected FilesystemException instead of the previous RuntimeException.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15447

Differential Revision: https://we.phorge.it/D25279
2023-06-08 10:32:23 +02:00
Andre Klapper
66dd1c35d8 Fix PHP 8.1 "strlen(null)" exception on SVN repo page with no branches
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=b325304b6e52), phorge(head=SvnRepoMain, ref.master=cb938d869c3f, ref.SvnRepoMain=cb938d869c3f)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionController.php:156]
```

Closes T15446

Test Plan: After applying this change, going to a newly created SVN repository  at `/diffusion/1/`, the page renders, showing the repository as Inactive and also "Empty Repository - This repository does not have any commits yet." as expected.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15446

Differential Revision: https://we.phorge.it/D25278
2023-06-08 10:31:20 +02:00
Andre Klapper
1028eb3ee9 Fix PHP 8.1 "strlen(null)" exception setting a Diffusion repo URI when diffusion.ssh-host is null
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=b325304b6e52), phorge(head=diffusionCreateRepoURI, ref.master=d8d65f3f87ed, ref.diffusionCreateRepoURI=d8d65f3f87ed)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryURI.php:755]
```

Closes T15444

Test Plan: After applying this change and setting a repo URI following the steps in T15444, the page "R10: URI 58" on `/diffusion/10/uri/view/58/` is correctly rendered without an exception.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15444

Differential Revision: https://we.phorge.it/D25273
2023-06-08 10:30:08 +02:00
Valerio Bozzolan
71e4eee275 Update Figlet implementation to be PHP8 compatible
Summary:
As of PHP ~v8 the zip_open and associated functions have been deprecated and
removed. The replacement is the ZipArchive API. This updates the figlet
implementation to use this API which has been present in PHP since 5.2.

Additionally in PHP 8 the use of squiggly brackets for indexing into arrays
is also deprecated. This updates to remove two uses of squiggly brackets and
replace with square brackets.

These two deprecations would result in being unable to load differential
revisions in which someone had commented using figlet remarkup.

Imported from:

https://secure.phabricator.com/rPd5c63c86e7e4e87d5f72b35b1bdb1e888aea49bc

https://secure.phabricator.com/rPbc6f4786a2e36441d17b765fde8e8e047840bc58

Closes T15289

Test Plan:
Applied these changes to an install and loaded a revision that had comments
where someone utilized figlet remarkup. The revision loaded properly and the
figlet comment rendered properly.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15064, T15289

Differential Revision: https://we.phorge.it/D25142
2023-06-05 09:16:57 -04:00
Aviv Eyal
cb938d869c Teach ./bin/celerity about sprite maps
Summary:
Add `./bin/celerity sprites`, to replace script `./scripts/celerity/generate_sprites.php`.
Also make new workflow run `./bin/celerity map` at the same time.

Fixes T15437.

Test Plan: Changes a file that goes in the sprites, run new command

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15437

Differential Revision: https://we.phorge.it/D25274
2023-06-03 09:57:05 -07:00
Andre Klapper
d8d65f3f87 Fix PHP 8.1 "strlen(null)" exception on UIExamples' Bars page
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=b325304b6e52), phorge(head=uiExamples, ref.master=dd24c94b0741, ref.uiExamples=dd24c94b0741)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarSegmentView.php:58]
```

Closes T15441

Test Plan:
After applying this change, going to `/uiexample/view/PhabricatorAphrontBarUIExample/`,"Bars (PhabricatorAphrontBarUIExample)" renders with beautiful colors.

To see that page, enable prototypes with:

    ./bin/config set phabricator.show-prototypes true

Also try to create a Milestone on a Project, with the Config `maniphest.points` enabled, and try to create some Tasks with different points. Visit its Workboard to see the bar that still works with a useful tooltip.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15441

Differential Revision: https://we.phorge.it/D25272
2023-06-03 11:50:52 +02:00
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
Andre Klapper
0cbcb110b0 Fix PHP 8.1 "strlen(null)" exceptions trying to View Branches of a Diffusion repository
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=e4fd31ec024e), phorge(head=D25241, ref.master=b1edfea09bad, ref.D25241=b1edfea09bad)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionBranchTableController.php:29]
```

```
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=e4fd31ec024e), phorge(head=D25241, ref.master=b1edfea09bad, ref.D25241=b1edfea09bad)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php:33]
```

Closes T15414

Test Plan: Applied these two changes and at least got to `(FilesystemException) Filesystem path "/var/repo/1/" does not exist.` as an error message, instead of being stuck at `(RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated`.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15414

Differential Revision: https://we.phorge.it/D25241
2023-06-02 20:05:14 +02:00
dylsss
cbc0e66154 Change erroneous loose comparison to strict comparison in tab panels
Summary:
Fix a loose comparison causing a bug when comparing the selected tab (0) with a tab which has an alphanumeric ID which doesn't begin with an integer.

E.g., `(0 == 'kq3p37awi2n5')` is true in PHP 7.4 and below, this can sometimes cause multiple tabs to be displayed when a tab panel is first loaded onto a page:

{F278735}

Test Plan: Create a tab panel with at least 3 tabs, add a couple more and ensure that multiple tabs aren't loaded.

Reviewers: O1 Blessed Committers, valerio.bozzolan, Cigaryno, avivey

Reviewed By: O1 Blessed Committers, valerio.bozzolan, Cigaryno, avivey

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

Maniphest Tasks: T15146

Differential Revision: https://we.phorge.it/D25067
2023-06-02 15:57:09 +02:00
Andre Klapper
6b8ec50148 Fix PHP 8.1 "preg_match(null)" exception when cloning a repository with no URI set
Summary:
`preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1.

Thus add a `phutil_nonempty_string()` check if the `$subject` parameter is a non-empty string.

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) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=arcpatch-D25250, ref.master=18554ea76ceb, ref.arcpatch-D25250=fade4603a799), phorge(head=diffusionEmptyBranchHistory, ref.master=e11c5486c92b, ref.diffusionEmptyBranchHistory=76f042e4b969)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> preg_match(string, NULL) called at [<phorge>/src/applications/diffusion/request/DiffusionGitRequest.php:6]
```

Closes T15435

Test Plan: After applying this change, try to "Clone" a Repository with no URI set shows the overlay dialog `Clone Repository - Repository has no URIs set.` as expected.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15435

Differential Revision: https://we.phorge.it/D25266
2023-05-31 09:40:22 +02:00
Andre Klapper
1dd9609bed Fix PHP 8.1 "preg_match(null)" exception which blocks rendering the "Browse Herald Rules" dialog
Summary:
`preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1.

Thus first check that `$subject !== null`.

```
EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=0e32dbc1ac8f), phorge(head=diffusionRepoPage, ref.master=5405134fa5db, ref.diffusionRepoPage=dbe5e3a68c41)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> preg_match(string, NULL) called at [<phorge>/src/applications/herald/typeahead/HeraldRuleDatasource.php:25]
```
Closes T15422

Test Plan: Applied this change; afterwards on the "Diffusion 🡒 Push Logs 🡒 Advanced Search" page at `/diffusion/pushlog/?repositories=PHID-REPO-someRepositoryString`, clicking the search icon for the "Blocked By" field correctly renders.the "Browse Herald Rules" overlay dialog, listing available Herald rules.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15422

Differential Revision: https://we.phorge.it/D25248
2023-05-31 09:38:39 +02:00
Andre Klapper
e11c5486c9 Fix typo in PhortuneMerchant.php
Summary: Closes T15429

Test Plan: Look at the string.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15429

Differential Revision: https://we.phorge.it/D25261
2023-05-30 12:00:51 +02:00
Andre Klapper
7cf210b763 Fix PHP 8.1 "strlen(null)" exception which blocks rendering Config's Database Status page
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.

Closes T15428

Test Plan:
Applied this change; afterwards displays "Database Status" page at `/config/database/` correctly rendered in web browser.

Also visit every single database name, to see that also there nothing explode.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15428

Differential Revision: https://we.phorge.it/D25260
2023-05-30 10:59:35 +02:00
Andre Klapper
72fdf232b4 Fix PHP 8.1 "strlen(null)" exception which blocks rendering Conduit's dashboard.panel.edit page
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.

Closes T15425

Test Plan: Applied this change; afterwards `/conduit/method/dashboard.panel.edit/` correctly renders in browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15425

Differential Revision: https://we.phorge.it/D25257
2023-05-30 10:57:43 +02:00
Andre Klapper
2a9eca696f Fix PHP 8.1 "strlen(null)" exception which blocks rendering a Diffusion repository page
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.

Closes T15421

Test Plan:
Applied this change, create a repository, and afterwards the repository page at `/diffusion/9/` is shown with its name and "Empty Repository - This repository does not have any commits yet."

- have a Diffusion repository with Staging Area and Automation already setup
- create a Differential patch from arc
- press the Land button on the UI and write random things inside

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15421

Differential Revision: https://we.phorge.it/D25247
2023-05-30 10:54:22 +02:00
Andre Klapper
f2329f8165 Correct two spelling mistakes in Differential
Summary: Closes T15269

Test Plan: Only changes to spelling.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15269

Differential Revision: https://we.phorge.it/D25252
2023-05-30 10:46:10 +02:00
Andre Klapper
ea43519c6b Correct spelling mistake in PhabricatorAuditEditor
Summary: Closes T15267

Test Plan: Only changes to spelling.

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

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

Maniphest Tasks: T15267

Differential Revision: https://we.phorge.it/D25251
2023-05-30 10:43:40 +02:00
Andre Klapper
0d81da5909 Fix PHP 8.1 "explode(null)" exception which blocks rendering the Multimeter page
Summary:
Passing null as an input string to explode() is deprecated in PHP 8.
Thus first check via `phutil_nonempty_string()` that the input string is not null.

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.

Closes T15361

Test Plan: Applied this change; afterwards `/multimeter/` correctly rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15361

Differential Revision: https://we.phorge.it/D25254
2023-05-29 12:35:54 +02:00
Edward Betts
4862eada5c Correct spelling mistakes
Test Plan: Only changes to spelling.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25238
2023-05-27 22:19:06 +01:00
Leon Eckardt
c5a365e1b2 Unify user-select CSS directives
Summary:
Removes the -khtml, -moz and -ms prefix, since most Browsers are natively supporting the user select directive.
The -webkit prefix is still kept or added for Safari, wich does not support user-select.

Ref: see https://we.phorge.it/D25024#815 for context

Test Plan: Removing the CSS should change nothing in modern browsers.

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan, Matthew

Reviewed By: O1 Blessed Committers, speck, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25025
2023-05-27 21:26:49 +02:00
Valerio Bozzolan
5405134fa5 Fix PHP 8.1 "strlen(null)" exception which can block repository imports
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.

Interestingly, in upstream they started fixing this yesterday, with just this minimal change:

https://secure.phabricator.com/rPf6214f060e780ecf7b565c5a0edbd28d85c03275#C11580NL1139

Premising counting the length of a string just to answer the question "is this empty?" may be overkill,
but premising that adopting stuff like phutil_nonempty_string() could be too risky, we just do
an explicit cast to string, to answer the question "Is this string empty?" just like it was done
under the hood by the strlen() function.

In short, this is probably nice and more readable than upstream (but not a competition).

Closes T15370

Test Plan:
- create a Mercurial repository
- push some things
- it should conclude the import (or at least unlock a different Exception)

Reviewers: O1 Blessed Committers, speck, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, amit, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15370

Differential Revision: https://we.phorge.it/D25204
2023-05-25 16:14:49 +02:00
Aviv Eyal
82e7f30a82 Update the supported PHP versions in the docs
Summary: Refs T15064.

Test Plan: Generated the doc locally, see that it says what I was planning for it to say.

Reviewers: valerio.bozzolan, aklapper, O1 Blessed Committers

Reviewed By: valerio.bozzolan, O1 Blessed Committers

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15064

Differential Revision: https://we.phorge.it/D25245
2023-05-25 06:55:27 -07:00
Valerio Bozzolan
55596bfad5 PHP Pitfalls: mention strlen() deprecation since PHP 8.1
Summary:
- expand documentation about PHP Pitfalls to mention strlen() in PHP 8.1
- mention phutil_string_cast()
- mention phutil_nonempty_string()
- add a commodity link from PHP Contributors Manual

Ref T15190

Test Plan: * check with your big eyes for typos

Reviewers: O1 Blessed Committers, Cigaryno, avivey

Reviewed By: O1 Blessed Committers, Cigaryno, avivey

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Tags: #documentation

Maniphest Tasks: T15190

Differential Revision: https://we.phorge.it/D25108
2023-05-25 13:43:33 +02:00
Andre Klapper
6d57904330 Fix PHP 8.1 "strlen(null)" exceptions which block rendering Browse Repositories overlay dialog
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.

Closes T15420

Test Plan: Applied these two changes; afterwards "Browse Repositories" overlay dialog gets rendered in web browser and lists existing repositories.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15420

Differential Revision: https://we.phorge.it/D25244
2023-05-24 18:10:21 +02:00
Andre Klapper
26d74ccc7c Fix PHP 8.1 "strlen(null)" exception which blocks deleting Phriction document
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.

Closes T15419

Test Plan:
Applied this changes and page at `/w/` correctly rendered saying `Document Deleted - This document has been deleted. You can edit it to put new content here, or use history to revert to an earlier version.`

Also test creating it again, and updating it again: it still works.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15419

Differential Revision: https://we.phorge.it/D25243
2023-05-24 18:09:12 +02:00
Andre Klapper
b1edfea09b Fix PHP 8.1 "strlen(null)" exception trying to create an empty Menu Item
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.

Closes T15398

Test Plan:
Applied this change and "Edit Menu Item" overlay dialog correctly shows "You must choose a project" resp. "You must choose a room." error message, now without an exception.

Go to /home/menu/configure/custom/ and also to /home/menu/configure/global/ and try:

- Add Label with name `0` / `1` / `1.123` etc.
- Add Label, Save again
- Add Link, Save again
- Add Application, Save again
- Add Divider, Save again
- Add Conpherence, Save again
- Add Link, Save Again
- Add Motivator (Cat Facts), Save again
- Add Form, Save again
- Order Items
- Activate/Disable Built-in Home (unrelated)
- Remove all the above

Also, tried on a Project menu.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15398

Differential Revision: https://we.phorge.it/D25230
2023-05-23 12:00:30 +02:00
Andre Klapper
19d9da7fea Fix PHP 8.1 "strlen(null)" exception which blocks Working Copy blueprint creation in Drydock
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. So, we adopt an explicit cast to string
in order to answer the question "Is this a non-empty string?" without relying on implicit
cast and deprecated things.

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

Closes T15409

Test Plan:
Applied this change and afterwards, selecting "Working Copy" on `/drydock/blueprint/edit/form/default/` does not show a RuntimeException on strlen() anymore. Instead, it shows a PhutilAggregateException covered in T15408.

Try also creating an integer "Custom Field" in some applications like Maniphest (maniphest.custom-field-definitions)
or in the People component (user.custom-field-definitions) etc., populating the related forms with your usual fuzzy tests.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15409

Differential Revision: https://we.phorge.it/D25235
2023-05-23 11:59:12 +02:00
Andre Klapper
2ffbef8820 Fix PHP 8.1 "trim(null)" exception which blocks rendering Reports' Burnup Rate page
Summary:
Since PHP 8.1, passing a null string to `trim()` is deprecated.

Thus first check that $row['oldValue'] is not null before trimming it.

Closes T15392

Test Plan: Applied this change; afterwards "Burnup Rate" page at `/maniphest/report/burn/` got correctly rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15392

Differential Revision: https://we.phorge.it/D25224
2023-05-23 11:58:19 +02:00
Andre Klapper
538cccc63e Fix PHP 8.1 "strlen(null)" exception setting Story Points on a Task
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. Here we adopt `phutil_string_cast()` to
reply to the question "is this an empty string?".

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

Closes T15390

Test Plan:
Enable `maniphest.points` in settings, for example with:

```
./bin/config set maniphest.points --stdin <<< '{"enabled":true}'
```

Then try to create a Task: it does not explode anymore in PHP 8.1+.

Also try to set various possible values from the Conduit API method "maniphest.edit".

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15390

Differential Revision: https://we.phorge.it/D25222
2023-05-23 11:57:45 +02:00
Andre Klapper
3999a28674 Fix PHP 8.1 exceptions which block adding an embedded File preview as a Comment
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
Receiving null 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.

Closes T15389

Test Plan:
Applied these three changes; afterwards writing `{F1234}` in the Task Comment text field finally rendered the image preview in the preview area, plus I could successfully add the Comment.

Additional cute tests:

```
Test alt:

{F1234,alt=0}
{F1234,alt=null}
{F1234,alt=123}
{F1234,alt=0.1}
{F1234,alt=[]}

Test width:

{F1234,width=0}
{F1234,width=10}
{F1234,width=10.1}
{F1234,width=10%}
{F1234,width=49.99%}
{F1234,width=100%}

Test height:

{F1234,height=0}
{F1234,height=10}
{F1234,height=10.1}
{F1234,height=10%}
{F1234,height=49.99%}
{F1234,height=100%}

Test mix width/height:

{F1234,height=0,width=0}
{F1234,height=10,width=15}
{F1234,height=10.1,width=15}
{F1234,height=10%,width=15%}
{F1234,height=49.99%,width=15%}
{F1234,height=100%,width=15%}
```

If you have no nuclear implosion and if dimensions are somehow respected and the alt text works, well done! Test passed.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15389

Differential Revision: https://we.phorge.it/D25221
2023-05-23 11:55:03 +02:00
Andre Klapper
d95200da91 Fix PHP 8.1 "strlen(null)" exceptions which block adding 2FA factor
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.

Closes T15388

Test Plan:
Applied these two changes; afterwards managed to add a 2FA factor and `/settings/user/username/page/multifactor/?id=1` correctly listed mys Authentication Factors.

Additional tests:

- Unset any eventual personal MFA
- Setup a personal MFA
- Login/Logout using the MFA
- Remove a personal MFA
- Setup a personal enroll message from /auth/mfa/1/
- Setup a personal MFA
- Login/Logout using the MFA
- (then cleanup removing your test MFA)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15388

Differential Revision: https://we.phorge.it/D25219
2023-05-23 11:53:31 +02:00
Andre Klapper
10fae71a04 Fix PHP 8.1 "explode(null)" exception which blocks rendering "Provide Multi-Factor Credentials" page
Summary:
Passing null to the `$string` in `explode(string $separator, string $string, int $limit)` is deprecated since PHP 8.1.
Thus do not explode but create an empty array if the input is null.

Closes T15397

Test Plan: Applied this change and afterwards the "Provide Multi-Factor Credentials" page at `/auth/finish/` showing the "App Code" field correctly rendered in the web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15397

Differential Revision: https://we.phorge.it/D25229
2023-05-21 07:57:32 +02:00
Valerio Bozzolan
c1c7699c98 Fix PHP 8.1 "strlen(null)" exceptions which block rendering the DarkConsole
Summary:
Since PHP 8.1 the function call `strlen(null)` is deprecated.

Since Phabricator/Phorge elevates deprecation warnings to exceptions, the
specific fix implies dealing with null, and dealing with real strings.

In the specific case, a simple cast was made to deal with real strings.

Closes T15315

Test Plan: Visit the Home Page with DarkConsole enabled in your configuration: no crashes

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: aklapper, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15315

Differential Revision: https://we.phorge.it/D25165
2023-05-20 19:18:32 +02:00
Andre Klapper
524dc83b4e Fix PHP 8.1 null parameter exceptions which block rendering the "Browse Projects" overlay dialog
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.

Similarly, passing `null` to the `$haystack` parameter of `strpos()` is deprecated in PHP 8.1.

Similarly, passing `null` to the `$string` parameter of `ltrim()` is deprecated in PHP 8.1.

Closes part of T15335

Test Plan: Applied these four changes in Phorge (plus the one change in D25180 in Arcanist) and the `Browse Projects` overlay dialog finally rendered in web browser and listed existing projects.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15335

Differential Revision: https://we.phorge.it/D25179
2023-05-20 17:48:53 +02:00
Andre Klapper
17ebf3a11f Remove PHP version suffixes on "Missing Required Extensions"; Mention dnf
Summary:
Explicitly mentioning PHP5 packages is outdated and confusing.
Also, mentioning dnf together with yum (apparently yum is still in use!). Good for yum users.

Closes T15352

Test Plan: Applied this change and strings on the "Missing Required Extensions" page rendered as expected.

Reviewers: O1 Blessed Committers, valerio.bozzolan, jgleeson

Reviewed By: O1 Blessed Committers, valerio.bozzolan, jgleeson

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

Maniphest Tasks: T15352

Differential Revision: https://we.phorge.it/D25203
2023-05-20 17:47:19 +02:00
Valerio Bozzolan
94d45de2f7 Fix PHP 8.1 "ltrim(null)" exception which blocks adding additional user email address
Summary:
Since PHP 8.1, passing a null string to `ltrim(string $string)` is deprecated.

Thus we make sure that `$request->getStr('email')` does not return null as default.

Closes T15376

Test Plan: Applied this change, afterwards repeated the steps to add a new email address on `/settings/panel/email/`. This time, it's possible to close the "Verification Email Sent" and the page `/settings/panel/email/` renders and lists the new email address.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15376

Differential Revision: https://we.phorge.it/D25210
2023-05-20 14:27:28 +02:00
Andre Klapper
1b905706b4 Fix PHP 8.1 "strlen(null)" exception which blocks rendering MFA Provider page
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.

Closes T15386

Test Plan: Applied this change, afterwards page "Mobile Phone App (TOTP)" at `/auth/mfa/4/` renders in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15386

Differential Revision: https://we.phorge.it/D25218
2023-05-20 11:48:32 +02:00
Andre Klapper
bff0f810a7 Fix PHP 8.1 "strlen(null)" exception which blocks task Bulk Editor page
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.

Closes T15391

Test Plan:
Applied this change and afterwards, "Bulk Editor" page on `/maniphest/bulk/` rendered correctly.

To test that:

- visit a list of some Tasks (like `/maniphest/`)
- filter something (this can be done in multiple ways)
- select Tasks
- click on Bulk Edit Selected Tasks

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15391

Differential Revision: https://we.phorge.it/D25223
2023-05-20 11:46:38 +02:00
Andre Klapper
44f2010a0b PhabricatorPhabricatorAuthProvider: Remove unnecessary Remarkup
Summary:
This is a small fix in a specific user message example. See other messages in the very same file which also use `<tt>`.

Here the problematic phrase:

{F292970}

See the example in the phrase "Use lowercase letters, digits, and periods. For example: ...".

Test Plan: After this change, the specific message "The URI where the OAuth server is installed. For example" from the page `/auth/config/edit/?provider=PhabricatorPhabricatorAuthProvider` does not have anymore backticks shown to the end user.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Differential Revision: https://we.phorge.it/D25232
2023-05-20 11:43:28 +02:00
Valerio Bozzolan
976a21f658 AphrontFormControl: fix regression for some specific Captions
Summary:
Fix a specific problem when visiting some specific pages like this one:

    /auth/config/edit/?provider=PhabricatorPhabricatorAuthProvider:

Regression introduced in:

562d36ef5f

Stack trace:

    [Fri May 19 14:23:35.506028 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] [2023-05-19 14:23:35] EXCEPTION: (InvalidArgumentException) Call to phutil_nonempty_string() expected null or a string, got: PhutilSafeHTML. at [<arcanist>/src/utils/utils.php:2127]
    [Fri May 19 14:23:35.506647 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] arcanist(head=arcpatch-D25049, ref.master=c14785c3795c, ref.arcpatch-D25049=1b6412c24640), phorge(head=arcpatch-D25216_1, ref.master=2df7ea13a387, ref.arcpatch-D25216_1=02b40a9e25eb)
    [Fri May 19 14:23:35.506661 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692]   #0 <#2> phutil_nonempty_string(PhutilSafeHTML) called at [<phorge>/src/view/form/control/AphrontFormControl.php:206]
    [Fri May 19 14:23:35.506665 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692]   #1 <#2> phutil_tag(string, array, array) called at [<phorge>/src/view/form/PHUIFormLayoutView.php:54]
    [Fri May 19 14:23:35.506667 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692]   #2 <#2> PHUIFormLayoutView::render() called at [<phorge>/src/view/form/AphrontFormView.php:160]

We keep 100% backward compatibility, reproducing the implicit cast happening automatically before PHP 8.1

It has also been simplified the non-empty check since that is possible after casting to string.

Closes T15404

Test Plan:
- Visit the page mentioned in the commit summary
- no longer explodes
- you still don't see empty Captions
- you still see populated Captions
- you still see HTML rendered for populated Captions

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15404

Differential Revision: https://we.phorge.it/D25231
2023-05-19 22:17:36 +02:00
Andre Klapper
678c7a78be Fix PHP 8.1 "strlen(null)" exceptions setting up Username/Password Authentication Provider
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.

Closes T15383

Test Plan:
Applied these two changes; afterwards "Username/Password" page at `/auth/config/view/1/` gets rendered in web browser.

Additional tests (you need D25231 to complete this test plan):

- Create WordPress Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Twitter Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Amazon Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Asana Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Bitbucket Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Disqus Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Disqus Auth; Edit; Disable Enable (and Disable again to cleanup)
- Create Facebook Auth; Edit; Disable Enable (and Disable again to cleanup)
- Create GitHub Auth; Edit; Disable Enable (and Disable again to cleanup)
- Create JIRA Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Google Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create LDAP Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Phorge Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Slack Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Twitch.tv Auth; Edit; Disable; Enable (and Disable again to cleanup)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15383

Differential Revision: https://we.phorge.it/D25216
2023-05-19 20:16:25 +02:00
Andre Klapper
9f1814f490 Fix PHP 8.1 "strlen(null)" and "preg_match()" exceptions which block repository creation
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.

Similarly, `preg_match()` does not accept passing `null` as `$subject` parameter since PHP 8.1.

Closes T15337

Test Plan: Applied these four changes and `/diffusion/4/manage/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15337

Differential Revision: https://we.phorge.it/D25182
2023-05-19 17:18:37 +02:00
Andre Klapper
912a933b02 Fix PHP 8.1 "strlen(null)" exceptions which block rendering Legalpad signatures
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.

Closes T15395

Test Plan: Applied these two changes; afterwards "All Signatures" page at `/legalpad/signatures/1/` gets rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15395

Differential Revision: https://we.phorge.it/D25226
2023-05-19 17:01:53 +02:00
Andre Klapper
26aed4935b Fix PHP 8.1 "strlen(null)" exception shown when sending SMS Test Message to Contact Number
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.

Closes T15382

Test Plan:
Applied this change and after performing steps to send a test message again, `/mail/detail/107/` page got rendered correctly
and I can see the "Status Details" with stuff like "//None//" or "No mailers are configured."

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15382

Differential Revision: https://we.phorge.it/D25215
2023-05-19 17:01:16 +02:00
Andre Klapper
8a1cfff1e8 Fix PHP 8.1 "strlen(null)" and "explode()" exceptions which block rendering Administrator Account Creation page
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.

Similarly, `explode(string $separator, string $string, int $limit)` does not accept
passing null instead of an actual string as input parameter either anymore.

Closes T15284

Test Plan: Applied these two changes. Afterwards, admin user account was created and Phorge homepage rendered in web browser on a fresh installation.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15284

Differential Revision: https://we.phorge.it/D25175
2023-05-19 16:59:41 +02:00
Andre Klapper
402a63c5de Fix PHP 8.1 "strlen(null)" exception which blocks rendering "Browse Dashboards" dialog
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.

But, that function does not accept null anymore since PHP 8.1.

Closes T15396

Test Plan: Applied this change (on top of D25179 and D25226) and the "Browse Dashboards" dialog got rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15396

Differential Revision: https://we.phorge.it/D25227
2023-05-19 12:00:48 +02:00
Valerio Bozzolan
2df7ea13a3 PhabricatorModularTransactionType: fix regression
Summary:
Fix a regression in this specific point:

    phutil_nonempty_string(integer) called at [<phorge>/src/applications/transactions/storage/PhabricatorModularTransactionType.php:342]

This regression was causing a broken Almanac page and maybe others.

Note: The function phutil_nonempty_string() is well-known to be very angry and
throws for any alien value. This is by design, and in many cases
this is appropriate. But not here.

The business logic here handles very generic types like integers
and really probably whatever scalar value coming from an user input
and then normalized to something else, not necessarily a string, but definitely
something that can be cast to string.

If you have better ideas about how to handle these cases, please join T15190.

Closes T15385

Test Plan:
To test Almanac:

1. go to `/almanac/network/` and create at least one network (example: "foo")
2. go to `/almanac/device/` and create at least one device (example: "bar")
3. visit that Device
4. Add Interface
    - test the creation of an empty Interface
    - test the creation of a right Interface (example: Network "foo", Address 127.0.0.1, Port 80)
    - nothing esplodes anymore

Reviewers: arnold, O1 Blessed Committers, avivey

Reviewed By: arnold, O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15385

Differential Revision: https://we.phorge.it/D25220
2023-05-12 21:37:41 +02:00
Andre Klapper
4d1adf6939 Fix PHP 8.1 "strlen(null)" exceptions which block rendering Log In page after user logout
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.

Closes T15384

Test Plan: Applied these four changes; logged in again; logged out again; finally saw "Log In" page with "Username or Email" and "Password" field on `/auth/loggedout/` rendered in web browser.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15384

Differential Revision: https://we.phorge.it/D25217
2023-05-12 12:06:16 +02:00
Andre Klapper
3a3112f67b Fix PHP 8.1 "strlen(null)" and preg_match() exceptions which block rendering "Browse Subscribers" overlay dialog
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.

Similarly, `preg_match()` does not accept passing `null` as `$subject` parameter since PHP 8.1.

Closes T15381

Test Plan: Applied these two changes (on top of D25179 and D25213), and on the task creation page, after clicking the magnifier icon in the "Subscribers" field, the "Browse Subscribers" overlay dialog got rendered.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15381

Differential Revision: https://we.phorge.it/D25214
2023-05-12 12:02:15 +02:00
Andre Klapper
bac87ca264 Fix PHP 8.1 "strlen(null)" exception[s] which block rendering "Browse Projects" overlay dialog
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.

Closes T15380

Test Plan: Applied these two changes (on top of D25179) and on the task creation page, after clicking the magnifier icon in the "Tags" field, the "Browse Projects" overlay dialog got rendered.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15380

Differential Revision: https://we.phorge.it/D25213
2023-05-12 12:00:30 +02:00
Andre Klapper
c2856b479f Fix PHP 8.1 "implicit conversion from float to int" exception on certain avatar colors which blocks rendering user pages
Summary:
Since PHP 8.1, conversion from float to integer should be explicit.

https://wiki.php.net/rfc/implicit-float-int-deprecate

According to `phlog`, the alpha channel value of the automatically created user
avatar image for a new user account sometimes is a float.

Thus always `round()` the alpha channel value to be an integer.

Closes T15375

Test Plan: Applied this change, created five user accounts via http://phorge.localhost/people/new/standard/ , and each resulting alpha value in `PhabricatorFilesComposeAvatarBuiltinFile.php` was an integer according to `phlog` (see corresponding Maniphest task). Rendering of each new user page always succeeded.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15375

Differential Revision: https://we.phorge.it/D25209
2023-05-12 11:58:22 +02:00
Andre Klapper
4d97195397 Fix PHP 8.1 "strlen(null)" exception when trying to add empty user email address
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.

Closes T15377

Test Plan: Applied this change, afterwards repeated the steps to add a new email address on `/settings/panel/email/` and left the "Email" field empty. This time, after selecting the "Save" button, the error message "Email is required." is displayed in the "New Address" overlay dialog.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15377

Differential Revision: https://we.phorge.it/D25211
2023-05-10 10:29:07 +02:00
Andre Klapper
c86364c2aa Fix PHP 8.1 "strlen(null)" exceptions which block rendering user page after creation with Welcome Email enabled
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.

Closes T15374

Test Plan: Applied these two changes, performed the user creation steps again, and afterwards the user page at `/p/user5/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15374

Differential Revision: https://we.phorge.it/D25208
2023-05-10 10:28:33 +02:00
Andre Klapper
ac4c951699 Fix PHP 8.1 "strlen(null)" exception which blocks dragging a task to a Workboard Column
Summary:
On a Workboard without any "Group by <something>", when moving a Task from a Column
to another, in PHP 8.1 there was a crash caused by a null passed to `strlen()`.

`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.

Closes T15373

Test Plan:
Applied this change and afterwards dragging a Task card to another Column succeeded,
with or without a "Group by <something>" query.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15373

Differential Revision: https://we.phorge.it/D25207
2023-05-09 18:37:50 +02:00
Andre Klapper
8d2b481bb5 Fix PHP 8.1 "strlen(null)" exceptions which block rendering page to import ICS calendar file
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.

Closes T15362

Test Plan: Applied these two changes and `/calendar/import/edit/` correctly rendered the "Create Import" page in the web browser, with the expected error about the missing ICS file (instead of an exception stacktrace).

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15362

Differential Revision: https://we.phorge.it/D25200
2023-05-08 23:13:12 +02:00
Andre Klapper
1b08be518e Fix PHP 8.1 "strlen(null)" exception which blocks rendering error pages for Packages' Create Package and Fund's Create Initiative
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.

Closes T15365

Test Plan: Applied this change and `/packages/package/edit/form/default/` and `/fund/create/` finally rendered in web browser, showing the expected error messages about not having entered any data in the creation page.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15365

Differential Revision: https://we.phorge.it/D25202
2023-05-08 21:43:17 +02:00
Andre Klapper
25e93501c3 Fix PHP 8.1 "strlen(null)" exception which blocks rendering Phortune account page
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.

Closes T15363

Test Plan: Applied this change and "Default Account" page `/phortune/account/1/details/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15363

Differential Revision: https://we.phorge.it/D25201
2023-05-08 14:36:14 +02:00
Andre Klapper
aa8baf1c8b Fix PHP 8.1 "strlen(null)" exception which blocks rendering a project's page when Reports prototype enabled
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.

This is exactly the same case as D25140.

Closes T15360

Test Plan: Applied this change and `/project/view/1/` rendered the workboard in the web browser as expected.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15360

Differential Revision: https://we.phorge.it/D25199
2023-05-08 14:35:22 +02:00
Andre Klapper
3819f7ff19 Fix PHP 8.1 "ltrim(null)" exception which blocks rendering five applications' Configure pages
Summary:
Since PHP 8.1, passing a null string to `ltrim(string $string, string $characters)` is deprecated.

Thus do not check for `$path = null` but check for `$path = ''` before passing `$path` as the `$string` parameter to `ltrim()`, like src/applications/settings/panel/PhabricatorSettingsPanel.php already does.

Closes T15359

Test Plan: Applied this change (on top of D25197) and five applications' Configure pages (Differential, Maniphest, Files, Paste, and Ponder) finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15359

Differential Revision: https://we.phorge.it/D25198
2023-05-08 14:33:43 +02:00
Andre Klapper
d74e9d825a Fix PHP 8.1 "strlen(null)" exception which blocks rendering most applications' Configure pages
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.

Added also a small inline documentation to better leave what I find.

Closes T15358

Test Plan:
Applied this change change and way more applications' Configure pages finally rendered in web browser.
For example, `/applications/view/PhabricatorAuditApplication/` is now correctly rendered.
(However, some pages expose followup exceptions to be handled in separate tasks.)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15358

Differential Revision: https://we.phorge.it/D25197
2023-05-08 13:23:31 +02:00
Andre Klapper
e5caf4333e Fix PHP 8.1 "strlen(null)" exception which blocks creating a blog post
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.

Closes T15357

Test Plan: Applied this change and created blog post at `/phame/post/view/3/blogpost/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15357

Differential Revision: https://we.phorge.it/D25196
2023-05-08 13:20:29 +02:00
Andre Klapper
eba8012d3e Fix PHP 8.1 "strlen(null)" exception which blocks blog rendering
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.

Closes T15356

Test Plan: Applied this change change on top of D25194 and `/phame/blog/view/1/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15356

Differential Revision: https://we.phorge.it/D25195
2023-05-08 13:19:41 +02:00
Andre Klapper
8495060f82 Fix PHP 8.1 "strlen(null)" exception which blocks blog creation
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.

Closes T15355

Test Plan: Applied this change and `/phame/blog/manage/3/` correctly rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15355

Differential Revision: https://we.phorge.it/D25194
2023-05-08 13:18:41 +02:00
Andre Klapper
1b4015d2c1 Fix PHP 8.1 "strlen(null)" exception which blocks rendering Pholio mock preview
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.

Closes T15353

Test Plan: Applied this change and `/pholio/create/` displayed an image preview after uploading an image file.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15353

Differential Revision: https://we.phorge.it/D25193
2023-05-07 12:37:00 +02:00
Valerio Bozzolan
e9e2c95413 Fix regression in PHUIObjectItemView.php:662: allow PhutilURI and other stringlike
Summary:
This fixes this specific exception that can happen with whatever PHP version in some pages:

    Call to phutil_nonempty_string() expected null or a string, got: PhutilURI from PHUIObjectItemView.php:662

The regression was introduced since:

b56d86e48d

The problem is caused by the fact that we are trying to introduce very strict checks, and sometime we are too much strict.

In this specific case we use `phutil_nonempty_stringlike()` since it also allows objects with a `__toString()` method.

In order not to leave these cases to chance, we have added a log line, which can be removed in the future.

If you see this log line, report it in the respective Task. Thank you!

Closes T15306
Ref T15316

Test Plan:
1. {nav Dashboard > Add a Panel}: no crash
2. {nav Diffusion repo > README}: no crash
3. {nav Herald > Create}: no crash

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, aklapper, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15306, T15316

Differential Revision: https://we.phorge.it/D25157
2023-05-06 15:57:16 +02:00
Andre Klapper
651e3f7263 Fix PHP 8.1 "strlen(null)" exception which blocks rendering a File page when Alt Text was altered
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.

Closes T15342

Test Plan:
Applied these two changes on top of D25186.
Added an Alt Text to a file; page of the File now rendered correctly in web browser.
Removed Alt Text from a file; page of the File now rendered correctly in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15342

Differential Revision: https://we.phorge.it/D25187
2023-05-06 04:08:20 +02:00
Andre Klapper
6c692ddbbb Fix PHP 8.1 "strlen(null)" exceptions which block rendering page of a File
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.

Closes T15341

Test Plan: Applied these four changes and file page at `/F91` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15341

Differential Revision: https://we.phorge.it/D25186
2023-05-06 04:07:03 +02:00
Andre Klapper
519acd9a10 Fix PHP 8.1 "strlen(null)" exception which blocks Space creation
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.

Closes T15340

Test Plan: Applied this change and page `/S3` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15340

Differential Revision: https://we.phorge.it/D25185
2023-05-06 04:05:37 +02:00
Andre Klapper
ab69bcccd9 Fix PHP 8.1 "strlen(null)" exceptions which block adding Dashboard to Project Menu
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.

Closes T15339

Test Plan: Applied these four changes and `/dashboard/install/1/project/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15339

Differential Revision: https://we.phorge.it/D25184
2023-05-06 04:04:20 +02:00
Andre Klapper
a3861edc19 Fix PHP 8.1 "strlen(null)" exception which blocks editing a Dashboard Tab Panel
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.

Closes T15345

Test Plan: After applying this change, the "Edit Panel" page at `/dashboard/panel/edit/2/` correctly rendered in the web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15345

Differential Revision: https://we.phorge.it/D25189
2023-05-05 14:53:55 +02:00
Andre Klapper
f4d28119e8 Fix PHP 8.1 "strlen(null)" exception when DarkConsole is enabled
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.

This is not visible in the web user interface, only in the PHP error log.

Closes T15344

Test Plan: Applied this change, on top of D25165 locally applied, and no stacktrace is printed anymore in the PHP error log.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15344

Differential Revision: https://we.phorge.it/D25188
2023-05-05 14:51:34 +02:00
Andre Klapper
b0044bad62 Fix PHP 8.1 "strlen(null)" exception which blocks creating personal and global Herald rules
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.

Closes T15348

Test Plan:
Applied this change (on top of D25157) and creation form at `/herald/edit/?content_type=HeraldPreCommitRefAdapter&rule_type=personal` rendered in web browser.
Same applies for other types of personal and global Herald rules.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15348

Differential Revision: https://we.phorge.it/D25190
2023-05-05 12:53:14 +02:00
Valerio Bozzolan
8eaa7c1ccf Fix PHP 8.1 "strlen(null)" exception which blocks rendering a config page
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.

Closes T15336

Test Plan: Applied this change and `/config/edit/load-libraries/` correctly rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15336

Differential Revision: https://we.phorge.it/D25181
2023-05-04 10:48:26 +02:00
Andre Klapper
953726d71b Fix PHP 8.1 "strlen(null)" exception which blocks creating a project with an empty Description field
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.

Closes second half of T15331

Test Plan: Applied these two changes (one in Arcanist, one in Phorge). Project with empty Description field was created and `/project/view/projectid/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15331

Differential Revision: https://we.phorge.it/D25177
2023-05-03 19:02:11 +02:00
Andre Klapper
8a3e063000 Fix PHP 8.1 "strlen(null)" exceptions which block rendering Auth's Customize Messages page
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.

Closes T15325

Test Plan: Applied these three changes and all seven subpages (e.g. `/auth/message/user.edit.username/`) finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15325

Differential Revision: https://we.phorge.it/D25172
2023-05-03 12:51:21 +02:00
Andre Klapper
b0cfb6ca6a Fix PHP 8.1 "strlen(null)" exception which blocks rendering project's Configure Menu page
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.

Closes T15327

Test Plan: Applied this change (on top of D25166) and `/project/1/item/configure/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15327

Differential Revision: https://we.phorge.it/D25173
2023-05-03 12:49:55 +02:00
Andre Klapper
0ceb44c38a Fix PHP 8.1 "strlen(null)" exception which blocks rendering Configuration's Settings page
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.

Closes T15324

Test Plan: Applied this change and `/config/settings/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15324

Differential Revision: https://we.phorge.it/D25171
2023-05-03 10:24:52 +02:00
Andre Klapper
1d8483a9bd Fix PHP 8.1 "strlen(null)" exception which blocks rendering the "Manage Menu" page
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.
However, the parameter `$item_id` is a numeric value when populated.
Thus replace `strlen()` with `phutil_nonempty_scalar()` as `phutil_nonempty_string()` could break a Conduit API consumer sending a numeric value.

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

Closes T15317

Test Plan: Applied this change and `/home/menu/configure/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15317

Differential Revision: https://we.phorge.it/D25166
2023-05-03 10:20:50 +02:00
Andre Klapper
8f669ea082 Fix PHP 8.1 "strlen(null)" exceptions which block rendering the People page
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 general 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.

Use `phutil_nonempty_scalar()` instead in `PhabricatorSearchDateField.php` as
input could only be integer instead of string.

Closes T15297

Test Plan: Applied these four changes (on top of D25144, D25145, D25146) and `/people/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15297

Differential Revision: https://we.phorge.it/D25147
2023-05-01 22:31:28 +02:00
Andre Klapper
aea1d47379 Fix PHP 8.1 "strlen(null)" and "array_slice(null)" exceptions which block typeahead completion proposals
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.

`array_slice()` no longer accepts passing `null` as a parameter.
This behavior is deprecated since PHP 8.1. Adding an if clause; not using a
Null Coalescing Operator (PHP 7+) as Phorge currently still supports PHP 5.5.

Closes T15321

Test Plan:
Applied these two changes on top of D25147. Afterwards, typeahead autocompletion
proposal dropdowns for the three fields "Assigned To", "Subscribers", "Tags" got
displayed in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15321

Differential Revision: https://we.phorge.it/D25170
2023-05-01 22:29:37 +02:00
Andre Klapper
dff04ba91d Fix some PHP 8.1 "strlen(null)" exceptions which block rendering a project page
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.

Closes T15313

Test Plan:
Applied these three changes (with D25144, D25145, D25146, D25147, D25151,
D25152, D25153 on top).
Afterwards end up with the unresolved exception covered by T15263.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15313

Differential Revision: https://we.phorge.it/D25163
2023-05-01 22:26:27 +02:00
Andre Klapper
4d88095f2a Fix PHP 8.1 "strlen(null)" exception which blocks rendering the Projects page (and log alien values)
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 general replacement.

In this specific case we use `phutil_nonempty_stringlike()` since we are not sure
if the variable `href` should be just a string or other objects.

In order not to leave these cases to chance, we have added a log line, which can be
removed in the future.

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.

Closes T15303
Ref T15316

Test Plan:
Applied this change (on top of D25144, D25145, D25146, D25147, D25150,
D25142) and `/project/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15303, T15316

Differential Revision: https://we.phorge.it/D25153
2023-05-01 22:22:48 +02:00
Andre Klapper
b44665aefe Fix PHP 8.1 "strlen(null)" exception which blocks rendering Notifications' Advanced Search page
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.

Closes T15320

Test Plan: Applied this change and `/notification/query/advanced/` rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15320

Differential Revision: https://we.phorge.it/D25169
2023-05-01 22:18:44 +02:00
Andre Klapper
63647f41f8 Fix PHP 8.1 "strlen(null)" exception[s] which blocks rendering External Editor user settings page
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.

Closes T15310

Test Plan:
Applied this change (on top of D25144, D25145, D25146, D25147, D25151,
D25152, D25153) and `/settings/panel/editor/` correctly rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15310

Differential Revision: https://we.phorge.it/D25160
2023-05-01 22:13:54 +02:00
Andre Klapper
255325bd04 Fix PHP 8.1 "strlen(null)" exception which blocks rendering user's Edit Profile page
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.

Closes T15319

Test Plan:
Applied this change (on top of D25147, D25153, D25167) and
`/people/editprofile/userid/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15319

Differential Revision: https://we.phorge.it/D25168
2023-05-01 22:05:37 +02:00
Andre Klapper
9aa8d09d31 Fix PHP 8.1 "strlen(null)" exceptions which block rendering the People page of a user
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.

Closes T15318

Test Plan:
Applied these five changes on top of D25147 and D25153, and both `/p/username/`
and `/people/manage/userid/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15318

Differential Revision: https://we.phorge.it/D25167
2023-05-01 22:03:41 +02:00
Andre Klapper
5a76e8d262 Fix PHP 8.1 "strlen(null)" exception which blocks loading icons when creating new Diffusion repository
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.

Closes T15301

Test Plan: Applied this change (on top of D25150) and icons rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15301

Differential Revision: https://we.phorge.it/D25151
2023-05-01 22:01:41 +02:00
Andre Klapper
6e88528370 Fix PHP 8.1 "strlen(null)" exception which blocks rendering list of Active/All projects
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.

Closes T15312

Test Plan:
Applied this change (on top of D25144, D25145, D25146, D25147, D25151, D25152, D25153 and `/project/query/active/` rendered correctly in web browser.

Tested surfing various pages with and without Maniphest's `maniphest.subtypes`.

If you need some example custom fields, this is an example:

```
[
    {
      "key": "default",
      "name": "Task"
    },
    {
      "key": "bug",
      "name": "Bug"
    },
    {
      "key": "log",
      "name": "LogSpam"
    },
    {
      "key": "deadline",
      "name": "Deadline"
    }
  ]
```

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15312

Differential Revision: https://we.phorge.it/D25162
2023-05-01 15:55:42 +02:00
Andre Klapper
313d3b7bf2 Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Maniphest task creation page
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.

Closes T15302

Test Plan:
Applied these five changes (on top of D25144, D25145, D25146, D25147, D25151)
and `/maniphest/task/edit/form/default/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15302

Differential Revision: https://we.phorge.it/D25152
2023-05-01 15:52:23 +02:00
Andre Klapper
bccd4f5981 Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Dashboard page
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.

Closes T15295

Test Plan: Applied these four changes (on top of D25144 and D25145) and `/dashboard/` finally rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15295

Differential Revision: https://we.phorge.it/D25146
2023-05-01 15:45:24 +02:00
Andre Klapper
f8ae17bb6a Fix PHP 8.1 "strlen(null)" exception which blocks rendering the Home page
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.

Closes T15296

Test Plan: Applied this change and Home page rendered in web browser.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15296

Differential Revision: https://we.phorge.it/D25145
2023-05-01 15:37:56 +02:00