1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00
Commit graph

16018 commits

Author SHA1 Message Date
Andre Klapper
412c01ffa6 Fix PHP 8.1 "strlen(null)" exception for "/bin/auth cache-pkcs8" without parameter
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 patch also fixes another similar strlen() occurrence in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php:35]
```

Test Plan: Run `../phorge/bin/auth cache-pkcs8`: Get no `strlen()` error anymore but only expected output `Usage Exception: You must specify the path to a public keyfile with --public.`

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/D25587
2024-04-17 13:08:30 +02:00
Andre Klapper
0e53f91c97 Fix PHP 8.1 "strlen(null)" exception for "/bin/herald test" without parameter
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 patch also fixes another similar strlen() occurrence in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/herald/management/HeraldTestManagementWorkflow.php:33]
```

Test Plan: Run `../phorge/bin/herald test`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify an object to test rules for with "--object".`

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/D25586
2024-04-17 13:08:05 +02:00
Andre Klapper
d630f2281b Fix PHP 8.1 "strlen(null)" exception for "/bin/conduit call" without parameter
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 patch also fixes two similar `strlen()` occurrences in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php:44]
```

Test Plan: Run `../phorge/bin/conduit call`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a method to call with "--method".`

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/D25584
2024-04-17 13:07:30 +02:00
Andre Klapper
98cbf5fa19 Fix PHP 8.1 "strlen(null)" exception for "/bin/files encode" without --as parameter
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/management/PhabricatorFilesManagementEncodeWorkflow.php:45]
```

Test Plan: Run `../phorge/bin/files encode F1`: Get no `strlen()` error anymore but only expected output `Usage Exception: Use --as <format> to select a target encoding format. Available formats are: aes-256-cbc, rot13, raw.`

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/D25595
2024-04-17 09:16:58 +02:00
Andre Klapper
0bdfcc47e7 Fix PHP 8.1 "strlen(null)" exception for "/bin/files migrate" without parameter
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/management/PhabricatorFilesManagementMigrateWorkflow.php:65]
```

Test Plan: Run `../phorge/bin/files migrate`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify an engine to migrate to with `--engine`. Use `files engines` to get a list of engines.`

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/D25594
2024-04-17 09:16:33 +02:00
Andre Klapper
c59a883e9d Fix PHP 8.1 "strlen(null)" exception for "/bin/herald rule" without parameter
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/herald/management/HeraldRuleManagementWorkflow.php:36]
```

Test Plan: Run `../phorge/bin/herald rule`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a rule to edit with "--rule <id|monogram>".`

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/D25585
2024-04-17 00:41:13 +02:00
Andre Klapper
b29e5aa7ca Fix PHP 8.1 "strlen(null)" exception for "/bin/search query" without parameter
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/search/management/PhabricatorSearchManagementQueryWorkflow.php:24]
```

Test Plan: Run `../phorge/bin/search query`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a query with --query.`

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/D25589
2024-04-17 00:40:29 +02:00
Andre Klapper
102c43fb6a Fix PHP 8.1 "strlen(null)" exception for "/bin/auth refresh" without parameter
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/auth/management/PhabricatorAuthManagementRefreshWorkflow.php:37]
```

Test Plan: Run `../phorge/bin/auth refresh`: Get no `strlen()` error anymore but only expected output `Found 3 account(s) to refresh.` (or similar)

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/D25583
2024-04-17 00:38:16 +02:00
Andre Klapper
2c7be156a8 Fix PHP 8.1 "strlen(null)" exception for "/bin/auth unlimit" without parameter
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/auth/management/PhabricatorAuthManagementUnlimitWorkflow.php:30]
```

Test Plan: Run `../phorge/bin/auth unlimit`: Get no `strlen()` error anymore but only expected output `Usage Exception: Use --user to choose a user to reset actions for.`

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/D25582
2024-04-17 00:37:32 +02:00
Andre Klapper
9101c0b63d Fix PHP 8.1 "strlen(null)" exception for "/bin/nuance update" without parameter
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/nuance/management/NuanceManagementWorkflow.php:69]
```

Test Plan: Run `../phorge/bin/nuance update`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a item with --item.`

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/D25581
2024-04-17 00:35:44 +02:00
Andre Klapper
6a2f2a589a Fix PHP 8.1 "strlen(null)" exception for "/bin/nuance import" without parameter
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/nuance/management/NuanceManagementWorkflow.php:8]
```

Test Plan: Run `../phorge/bin/nuance import`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a source with --source.`

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/D25580
2024-04-17 00:35:05 +02:00
Andre Klapper
05798a6301 Fix PHP 8.1 "strlen(null)" exception for "/bin/files generate-key" without parameter
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/management/PhabricatorFilesManagementGenerateKeyWorkflow.php:23]
```

Test Plan: Run `../phorge/bin/files generate-key`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify the type of key to generate with --type.`

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/D25579
2024-04-17 00:29:24 +02:00
Andre Klapper
79464882da Fix PHP 8.1 "addcslashes(null)" exception exporting task list to tab-separated text
Summary:
When a column value to export to Tab-Separated Text is empty, `null` is passed to `addcslashes()` which is deprecated behavior since PHP 8.1.
Thus only call `addclashes()` when the value is set.

```
ERROR 8192: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorTextExportFormat.php:45]
```

Closes T15771

Test Plan: Export a Maniphest task list of query results to Tab-Separated Text.

Reviewers: O1 Blessed Committers, 20after4, speck

Reviewed By: O1 Blessed Committers, 20after4, speck

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

Maniphest Tasks: T15771

Differential Revision: https://we.phorge.it/D25568
2024-04-15 16:42:22 +02:00
Aviv Eyal
0d9ca2589f Make sure offset is an integer
Summary:
Older git versions allowed the `--skip` to get empty string as value and interpreted that to an int.
We were sending `null` in some places where we wanted a `0`, so it all worked out.

Since https://git.kernel.org/pub/scm/git/git.git/commit/revision.c?id=71a1e94821666909b7b2bd62a36244c601f8430e git fails when provided empty string for an integer.

See Q124 and T15783.

Test Plan: Have recent git version (that fails with `--skip ''`, navigate to `/diffusion/1/history/master/`) - see history.

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/D25575
2024-04-12 19:28:16 +03:00
603c877fa0 Fix phacility link for arcanist guides
Summary: Signed-off-by: Yongmin Hong <revi@pobox.com>

Test Plan: Checkout https://we.phorge.it/book/phorge/article/arcanist and https://we.phorge.it/book/phorge/article/arcanist_quick_start/ and verify the new clone URL.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

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

Differential Revision: https://we.phorge.it/D25573
2024-04-11 17:38:01 +00:00
Andre Klapper
5a5c456264 Correct docs of PhabricatorPHIDType::getAllTypesForApplication()
Summary: The signature and return type of the `getAllTypesForApplication()` function differed from its docs.

Test Plan: Carefully read the code of the function and compare it to the `getAllInstalledTypes()` function above from which the docs were incorrectly copied.

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/D25572
2024-04-08 13:14:01 +02:00
Aviv Eyal
ecbef3fdf4 Show rest of task page when graph errors out
Summary: T15772.

Test Plan: Add a `throw` statement in graph calculation, load a task that has a graph, see message.

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/D25570
2024-04-05 13:26:38 +03:00
Andre Klapper
c0bc453405 Fix PHP 8.1 "preg_match(null)" exception exporting task list to CSV
Summary:
When a column value to export to CSV is empty, `null` is passed to `preg_match()` which is deprecated behavior since PHP 8.1.
Thus only call `preg_match()` when the value is set.

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorCSVExportFormat.php:51]
```

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorCSVExportFormat.php:55]
```

Closes T15770

Test Plan: Export a Maniphest task list of query results to CSV.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15770

Differential Revision: https://we.phorge.it/D25567
2024-04-03 11:57:25 +02:00
Katie
d4af32c1d4 Fix setup check for gzip request mangling being sent as GET
Summary:
Certain web servers (or cache layers such as Varnish) strip the body
of GET requests, resulting in the setup check failing when it would
otherwise function normally if a request is sent as POST.

Test Plan:
Phorge will no-longer mark the test as failing due to the body of a GET request being dropped.
As per RFC7231, certain implementations of HTTP/1.1 may reject the request or drop the payload
due to a previous revision of the spec where the body was supposed to be ignored (RFC2616, section 4.3)

Reviewers: O1 Blessed Committers, 20after4, speck, avivey

Reviewed By: O1 Blessed Committers, 20after4, speck, avivey

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

Differential Revision: https://we.phorge.it/D25566
2024-04-02 21:49:00 +03:00
Benjamin Kausch
ba835fe0ec Seperate repository home and browse view in tab menu
Summary:
The tab menu in a repository can be a bit confusing. The first tab will be rendered active for two distinctive states:

- the home view in the currently selected branch
- the browse view in the currently selected branch

This diff will give the home view a dedicated extra tab. When switching the branches, we won't switch between home and browse view like it is done now.

And I have changed the crumb text for the browse view to "Code" to match it up with the tab name.

Additionally the readme is now the first content on the home view.

Fixes T15728

Test Plan: Browse in your favorite repos and feel an UX elevation.

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

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

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

Maniphest Tasks: T15728

Differential Revision: https://we.phorge.it/D25538
2024-04-02 15:56:43 +02:00
Andre Klapper
713188bf17 Fix PHP 8.1 "strlen(null)" exception querying project tags for autocomplete without additional hashtag slugs defined
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/project/typeahead/PhabricatorProjectDatasource.php:99]
```

Closes T15761

Test Plan: Go to a task, enter `#` and start typing a project tag of a project which has no additional slugs defined.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15761

Differential Revision: https://we.phorge.it/D25556
2024-04-01 10:40:34 +02:00
Andre Klapper
186768ccfd Fix PHP 8.1 "strlen(null)" exception when received email lacks From header
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/metamta/storage/PhabricatorMetaMTAReceivedMail.php:527]
```

Closes T15767

Test Plan: See T15767

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15767

Differential Revision: https://we.phorge.it/D25564
2024-03-31 15:21:11 +02:00
Valerio Bozzolan
5263d5d590 Custom integer fields: fix search by array of possible values
Summary:
This minimal changes seems the natural expansion of this search function,
that "seems" designed to only search with a single value, but the backend
is designed to receive an array of possible values.

Look at the same method in PhabricatorStandardCustomFieldLink that already
works also for array inputs.

To get extra confidence look at the method withApplicationSearchContainsConstraint()
that works perfectly with arrays (to be honest it only works with arrays in mind...)

This feature allows to avoid crashes when extension developers tries to run "IN" queries
because for example they try to follow our performance guidelines:

https://we.phorge.it/book/contrib/article/n_plus_one/

Closes T15752

Test Plan:
Have a nice custom integer field, like this one for Maniphest:

    {
      "mycompany.estimated-hours": {
        "name": "Estimated Hours",
        "type": "int",
        "caption": "Estimated number of hours this will take.",
        "search": true
      }
    }

You can reproduce T15752 before the change. It just works after the change.

Or, just trust your instincts by looking at the same method in PhabricatorStandardCustomFieldLink.

Also, use the "normal" frontend search page. Still works as usual.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15752

Differential Revision: https://we.phorge.it/D25554
2024-03-30 12:14:27 +01:00
Valerio Bozzolan
48e121c485 Config Projects Extra Fields: link to the doc (like User)
Summary:
Add a documentation link in a specific Config page, that is:

Config > Setting > projects.custom-field-definitions

Comparison example:

| User      | People     |
|-----------|------------|
|{F1633919} | {F1633920} |

This change is a boring follow-up of this one:

https://we.phorge.it/D25507

Test Plan:
Visit the page and click on the new link:

- /config/edit/projects.custom-field-definitions/

Visit this page that was the inspirational page:

- /config/edit/user.custom-field-definitions/

Check that no nuclear implosion is raised.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25552
2024-03-29 08:26:25 +01:00
Aviv Eyal
216d308507 Fix Project Hovercard rendering @mention
Summary:
Fix T15762. There's a complex interaction with project's AutoCapability requiring the membership info
to be already loaded, and the Mention rule assuming any project is fully loaded before trying to check
permissions.

As far as I can tell, the "contextObject" is currently used only to make the mention handle gray if
the mentioned user can't see it.

Test Plan: Load a Project's hovercard that @mentions a user that can't see the project - no crash.

Reviewers: aklapper, O1 Blessed Committers

Reviewed By: aklapper, O1 Blessed Committers

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15762

Differential Revision: https://we.phorge.it/D25562
2024-03-26 20:07:49 +02:00
Valerio Bozzolan
b1ae1b1a67 Remarkup code blocks: guess language from "name="
Summary:
The file name is a sufficient source of information, if available.

Closes T15729

Test Plan: The new unit test is green. Old unit tests are green.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15729

Differential Revision: https://we.phorge.it/D25560
2024-03-26 11:20:23 +01:00
Valerio Bozzolan
27f4b8321a Fix important regression in search engine
Summary:
Interestingly Phorge allows to paste a Phorge URL in the search bar to be redirected there...

Now this interesting feature was crashing the whole search engine for simple queries like "asdasd"
with the following exception message:

    Refusing to redirect to local resource "asdasd". This URI is not formatted in a recognizable way.

You are affected by this crash after this commit:

328aee033f

This specific commit is probably legitimate since "#asdasd" and "/asdasd" are indeed internal URIs,
plus, yes, there are some undocumented and untested cases like "asdasd" that may be considered
internal URIs as well. Or not. But this is just an undocumented corner-case.

In short:

PhabricatorDatasourceURIEngineExtension should not be built over undocumented corner-cases and
should require an absolute URI, with at least a domain.

Note that PhutilURI#getDomain() is always a string and never null, so we can do a strict check.

This fix also involves a micro-optimization to avoid duplicate URI parsing. Since the method was calling
the constructor PhutilURI(string) twice (line 13, line 24). Now just once.

Closes T15763

Test Plan:
Search "lol", no crash anymore.

Copy a random Phorge URL and paste that in your search bar. It still redirects there.

Reviewers: zhe, avivey, O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15763

Differential Revision: https://we.phorge.it/D25561
2024-03-26 07:30:10 +01:00
Valerio Bozzolan
9ebe856219 Update unit test of InterpreterBlockRule for "a {{{a}}}"
Summary:
This is supposed to render in plain text instead of crashing or giving an error, after D25415:

    a {{{a}}}

The related unit test is updated accordingly.

We have unnoticed this, because of the well-known bug T15500.

Ref T15372
See D25415

Test Plan:
This makes sense with the introduced functionality in D25415.

Unit tests are happy again.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15372

Differential Revision: https://we.phorge.it/D25559
2024-03-25 09:28:11 +01:00
Andre Klapper
d42b3eb0b1 Fix "Map omits required key" exception by comparing result order against modern field keys
Summary:
Sorting a Maniphest search query by custom fields throws a "Map returned omits required key" exception.

The `isCustomFieldOrderKey()` check still tested against legacy field key format (for example `[custom:]std:maniphest:deadline.due`) while the code passes modern field key format (for example `custom.deadline.due`).

After fixing this, `PhutilTypeSpec::checkMap()` throws an exception when a non-optional (extra) key `$column` is in `$columns` but not in the array of type parameters below to check against:
`"Got unexpected parameters: customfield, customfield.index.table, customfield.index.key"`
Thus add optional types for customfields in `buildPagingClauseFromMultipleColumns()` to allow them instead of throwing another exception.

Closes T15631

Test Plan:
* Have a custom field (with search: true) defined via http://phorge.localhost/config/edit/maniphest.custom-field-definitions/
* Have two tasks have the custom field set
* Go to http://phorge.localhost/maniphest/query/ , select the custom field (e.g. "Due Date (Reversed)") in the "Order By" field, and click the "Search" button. Iterate through the results via the "Next" button if needed

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15631

Differential Revision: https://we.phorge.it/D25504
2024-03-21 19:25:50 +01:00
Valerio Bozzolan
328aee033f isSelfURI: fix anchors and relative URIs (that are "self" indeed)
Summary:
Example cases that were wrongly considered external URLs:

- "#foo"
- "/foo"

Note that Phorge usually does not change stable things. In fact this thing
was not documented even inline, and was not even in the unit tests.

So this is a fix, and not a breaking change. Probably no one had ever tried it.

Closes T15182

Test Plan:
The already existing unit tests still work.

The added ones make sense.

There are no problems doing other random things.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15182

Differential Revision: https://we.phorge.it/D25555
2024-03-19 17:34:24 +01:00
Valerio Bozzolan
8fe3d68577 Avoid "Action with no effect" for auto-claim statuses after manually removing assignee
Summary:
Sometime you just want to flag something as Resolved and keep that task claimed by nobody.

But, there are some task statuses that can auto-claim, and "Resolved" is one of these.
So, if you "Resolved", Phorge tries to set yourself as claimer.

Keeping that "claimed by nobody" is a bit tricky and also generates a confusing warning.

In fact, after you "Resolved", you can override the defaults with:

- Add Action > Assign / Claim > (nobody)

The problem is, on saving, the above action causes this warning:

> **Action With No Effect**
> One of your actions has no effect:
> The task already has the selected owner.
> Apply remaining actions?
> [ Cancel ] [ Apply Remaining Actions ]

That warning "The task already has the selected owner" really means
"The task is already claimed by nobody" and, indeed, that is exactly what the user wants.

This patch intercepts the above action, and prevents the related confusing "non-effect" warning.

Thanks to hard troubleshooting from user https://we.phorge.it/p/aklapper/

See also https://we.phorge.it/D25476

Closes T15164

Test Plan:
Task 1 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, and **set <nothing>**
4. Save and, instead of any confusing warning, only the Status changes.

Task 2 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, keep it as-is
4. Save and, it works as expected (just like before)

Task 3 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, set to somebody else
4. Save and, it works as expected (just like before)

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15164

Differential Revision: https://we.phorge.it/D25550
2024-03-15 13:50:46 +01:00
David Lawrence
10a3f4fa19 Use predictable filenames when downloading raw diffs from a revision
Summary:
To prevent spammers from abusing this feature on a public server, do not include query parameters in the generated filenames. See <d8bb7d91b7>.

Ref T15665.

Test Plan: Download raw diff from a revision and check filename in URL.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15665

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

Signed-off-by: Zero King <l2dy@icloud.com>
2024-03-07 00:03:27 +08:00
Andre Klapper
179f866deb Make lipsum project generator also fill in project description
Summary:
`./bin/lipsum` allows to fill up a Phorge instance with bogus data for testing. When creating a project, the code creates a project title, project status, random subscribers/members and picks a random project creator, but does not set a project description.

Make this code also set a project description (which is implemented as a custom field).

Closes T15748

Test Plan:
* On the CLI, use `./bin/lipsum generate projects` to create a bogus project.
* In the web browser, go to `/project/query/all/` and open the project page of the recently created bogus project: See no project description.
* Apply this change.
* On the CLI, use `./bin/lipsum generate projects` to create another bogus project.
* In the web browser, go to `/project/query/all/` and open the project page of the recently created bogus project: See a random project description.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15748

Differential Revision: https://we.phorge.it/D25545
2024-03-05 12:07:55 +01:00
Merula Turdus
892f527b9f Improve remarkup codeblock syntax highlighting when using Dark Mode
Summary:
PhabricatorDefaultSyntaxStyle works now with 'CSS-color-aliases' instead of fixed colors.

The aliases are translated in the corresponding themes CelerityPostprocessor.

| Before    | After     |
|-----------|-----------|
| {F709419} | {F709421} |

Ref T15056

Test Plan:
1) bin/celerity syntax
2) bin/celerity map
3) bin/cache purge --all
4) sign in
5) go to user's Settings > Display Preferences and select the Accessibility (user interface) "Dark Mode".
6) go to Phriction or Maniphest and add a codeblock.

Example:

``` lang=php
<?php
final class Example extends PhabricatorApplication {
}
```

7) verify that codeblock content is readable
8) also check that with/without this, nothing changes in "normal" theme

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15056

Differential Revision: https://we.phorge.it/D25509
2024-03-03 15:58:03 +01:00
Valerio Bozzolan
bf15a2d98c Trigger: Add Sound "Coin"
Summary:
One preview is better than a thousand of words:

{F270656}

This Sound is probably universally recognized thanks to
videogames like Super Mario® or other popular platforms; but
this specific Coin Sound is not proprietary: it's released
with a Free as in Freedom of Speach license: Creative Commons 0.

As if that were not enough, this Coin sound, instead of
potentially creating frustration like many others - it positively
stimulates part of the human cerebral cortex involved in making
humans more addicted to Phorge. To be precise, this Coin sound is
particularly suitable to be associated with Trigger actions
such as:

- Mark as Resolved
- Move on to the next Milestone
- etc.

But the only limitation here, as usual in Phorge, is
your imagination.

Insert a Coin and have fun with Phorge.

Complete sound credits:

https://freesound.org/people/Jocabundus/sounds/678385/

2023, Jocabundus, Creative Commons Zero (public domain dedication)

This change also introduces a Credits page in Diviner to mentions this
kind of things. Future contributions in that page are encouraged.

Insert a Coin. Play again with Phorge.

Ref T15178
Ref T15248

Test Plan:
- Create a Project with a Workboard
- Create a Column
- Column > Gear > New Trigger...
- Action > Play Sound > "Coin"
- Create a Task on the Backlog column, and drop it on your new Column
- Turn on audio, have fun!

Reviewers: O1 Blessed Committers, Cigaryno, avivey, aklapper

Reviewed By: O1 Blessed Committers, Cigaryno, avivey, aklapper

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

Maniphest Tasks: T15178, T15248

Differential Revision: https://we.phorge.it/D25079
2024-03-03 12:17:48 +01:00
Mukunda Modell
32b5139d46 Diviner: Improve documentation for remarkup code blocks
Summary:
Improve remarkup reference documentation.

* Added a heading for `Code Blocks`
* Added a sentence mentioning the ##```lang## syntax which was added in {T15481}

Test Plan:
* Run `bin/diviner generate` to regen diviner docs.
* Check out the code blocks section of [[/book/phorge/article/remarkup/#code-blocks|Remarkup Reference]]

Reviewers: valerio.bozzolan, O1 Blessed Committers

Reviewed By: valerio.bozzolan, O1 Blessed Committers

Subscribers: tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25547
2024-03-02 05:32:25 -06:00
Valerio Bozzolan
6df26b98c1 Comments: avoid confusing warning about "core:file"
Summary:
If you are reading this commit message, it probably happened to you this situation:

1. Somebody published a comment that shows the file F123
2. You Submit another comment that shows F123 again

After you click "Submit", a wild warning may appear:

> Post as Comment
> ----
> The action you are taking has no effect:
> Transaction (of type "core:file") has no effect.
> Do you want to post your comment anyway?
> [Undo] [Continue]

In this case you probably contact your favorite Phorge administrator to translate that stuff.
This is an example unofficial translation:

> Post as Comment
> ----
> You mentioned a file. Phorge loves files. Phorge attach files. But somebody else already
> mentioned that file, successfully. So, since Phorge attach Files, Phorge will result in
> doing nothing special, since the file is already perfectly attached by Phorge.
> Phorge will just post your comment.
> Would you like me to just STFU and post your comment?
> [OMG I'm scared] [Post comment and STFU]

After this change you don't see anymore that warning. So it's even rarer in your Pokedex.

Closes T15293

Test Plan:
- Create a comment showing F123 (an existing file)
- Create another comment showing F123
- No wild warnings

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

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

Maniphest Tasks: T15293

Differential Revision: https://we.phorge.it/D25544
2024-02-29 09:17:09 +01:00
Andre Klapper
7cee42ca26 Replace all phurl.io short URIs with target URIs
Summary:
As of February 2024, phurl.io (which is not run by Phorge.it) shows HTTP 503 errors instead of redirecting to the target URIs.

Thus replace any URIs pointing to phurl.io with the corresponding target URIs, based on the mapping listed on https://secure.phabricator.com/phurl/.

Closes T15746

Test Plan: Carefully read the diff.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15746

Differential Revision: https://we.phorge.it/D25543
2024-02-28 14:59:29 +01:00
Andre Klapper
74ec4f7882 Fix typo "pohrge" in "Adding New Classes" documentation
Summary: Fix typo "pohrge" in "Adding New Classes" documentation

Test Plan: Carefully read letter by letter.

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/D25541
2024-02-28 13:52:16 +01:00
Aviv Eyal
8667ed45fa Fix an instance of strlen(null)
Summary: Ref Q112, ref T15064.

Test Plan:
Enter the text `[[hello]]` in a remarkup field - without this change, it causes a deprecation warning in the log.

This doesn't happen if the content looks like a valid URL - this is the "Wiki Link" syntax.

Reviewers: bekay, O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15064

Differential Revision: https://we.phorge.it/D25539
2024-02-23 17:06:26 +02:00
Aviv Eyal
7d8c84a7bd Update PHP versions in install guide: Remove 5, Add 8.
Summary: Ref T15737. Ref T15554. Ref T15064. Ref T15047.

Test Plan: Generate diviner, read section.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15737, T15554, T15064, T15047

Differential Revision: https://we.phorge.it/D25537
2024-02-23 13:35:41 +02:00
Benjamin Kausch
89a5d3132c Implements copy button in clone repo modal
Summary:
This diff adds a copy button to every repo uri in the clone repo modal. I have made the button to select the text to a merely structural span before the input - it just shows the type of the repository uri. When you click inside the input, the entire uri will be selected. Also I have uncluttered the HTML structure. A table is not needed here, nothing a flex block can't handle.

| Before    | After     |
|-----------|-----------|
| {F1360344} | {F1368592} |

While at it, I have extended the used javascript copy behavior. First of all: `document.execCommand('copy')` [[ https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand | could stop working every moment in every browser ]]. The [[ https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard | new clipboard API ]] is the way to go, so I have implemented it as the preferred method. The old method is kept as a fallback. And I have added a very nice feature: If defined, the behavior will now issue success or error notifications. See the changed UIExamples for that.

To support the shrinking of JS code with async functions I have patched the JsShrink source.

Test Plan: Go to a repository, hit the clone button and use the new copy button. You will see a shiny notification as a reward.

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

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

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

Differential Revision: https://we.phorge.it/D25536
2024-02-15 19:38:39 +01:00
Andre Klapper
e2bec4c1f5 Improve messages when no image formats are supported (due to GD not installed)
Summary:
When GD is not installed, trying to set a custom image for a project/blog/repository/user/etc displays unhelpful error messages (`This server only supports these image formats: .` and `Supported formats: `) due to the array of supported image formats being empty.

Display clearer messages instead.

Closes T15720

Test Plan: Do not have php-gd installed, go to `/project/manage/1/`, take a look at the string below the "Upload Picture" button, select {nav icon=picture, name=Edit Picture} in the sidebar, select `Custom: Choose Icon and Color...`, `Choose Background Color` and `Choose Icon`, then click the `Save Image` button. Also try to upload a custom image and look at the error message.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15720

Differential Revision: https://we.phorge.it/D25525
2024-02-13 17:06:57 +01:00
Andre Klapper
052b5f41c7 Fix PHP 8.1 "strlen(null)" exception rendering dashboard panel with latest tasks when custom int 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.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php:56]
```

Closes T15685

Test Plan: After configuring a custom `int` field and a dashboard panel to query and listed the latest created tasks, access the panel and check the PHP error log.

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15685

Differential Revision: https://we.phorge.it/D25489
2024-02-12 13:26:19 +01:00
Andre Klapper
821708414e Allow to uninstall (hide) Audit application
Summary:
While many Phorge applications can be uninstalled (such as Differential for pre-merge commit review), this has not been the case for Audit (post-merge commit review) since rP11861265fe94fa97e4d0563c5bdb7b8cac27282d.

In installations which do not use Audit in their workflows, exposing Audit related UI elements creates additional clutter and complexity.

Fixes T15129

Test Plan:
* Go to `/applications/view/PhabricatorAuditApplication/` and click "Uninstall"
* View an individual merged commit in Diffusion, click "Edit Commit" in the sidebar to go to `/diffusion/commit/edit/1/`, see that "Auditors" datasource is not displayed
* View an individual merged commit in Diffusion, click the "Add Action..." dropdown, see that the "Audit Action" section and its entries "Accept Commit" and "Raise Concern" are not displayed
* View an individual merged commit in Diffusion, click the "Add Action..." dropdown, see that the "Change Auditors" entry is not displayed
* Go to `/conduit/` and see that the API method "audit.query" and the entire section "audit" is not displayed
* Go to `/diffusion/commit/` and see no "Active Audits" and "Audited" searches in the left side bar
* Go to `/diffusion/commit/query/all/` and see that no "Auditors" entry is shown for each commit
* Go to `/diffusion/commit/query/all/` and see that no audit related entry is shown in the grey column on the right (if Harbormaster is not installed, there will be no grey column at all)
* Go to `/herald/edit/?content_type=commit&rule_type=global` and see that no Condition entry "Auditors" and no Condition entry "Affected packages that need audit" is displayed
* Go to `/herald/edit/?content_type=commit&rule_type=personal` and see that no "Add me as an auditor" Herald action and no "Added Auditors" Herald condition is displayed

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15129

Differential Revision: https://we.phorge.it/D25503
2024-02-12 12:10:06 +01:00
Mark Jervelund
b445e1d80d Fix config transaction rendering error on auth page by allowing PhutilSafeHTML
Summary: Closes T15706

Test Plan: Checked that the page worked as expected with changes implemented

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

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

Maniphest Tasks: T15706

Differential Revision: https://we.phorge.it/D25512
2024-02-12 11:52:29 +01:00
Jean Guyomarc'h
a7fb04f96c fix PHP 8 "strlen(null)" when moving paths with missing options
Summary:
Running ./bin/repository move-paths without specifying --from nor --to
leads to the PHP 8 error about strlen() not accepting null parameters.

Test Plan: Running ./bin/repository move-paths without --from/--to (shows a proper error)

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

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

Differential Revision: https://we.phorge.it/D25484
2024-02-12 11:05:31 +01:00
Aviv Eyal
f81e821abf Mark manually created Diffs as new objects to fix empty Feed transaction entries
Summary:
When creating a Differential diff manually via `/differential/diff/create/` in the web browser instead of using Arcanist, `setIsCreateTransaction(true)` for the transaction type `DifferentialDiffTransaction::TYPE_DIFF_CREATE` to avoid an empty `Transaction` field in the Feed and avoid `strncmp()` complaining about a null value being passed.

For gory details, see the comments in T15659.

```
ERROR 8192: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/policy/query/PhabricatorPolicyQuery.php:314]
```

Closes T15659

Test Plan:
1. Create a valid diff via `/differential/diff/create/`
2. Go to `/feed/transactions/query/advanced/` and set `Object Types` to `Differential Diff` and click `Search`
3. See two entries in the `Transaction` column for the just created diff: One says "created this diff", the other one says "created this object with visibility" and is not an empty line anymore which triggered an exception.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

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

Maniphest Tasks: T15659

Differential Revision: https://we.phorge.it/D25517
2024-02-09 11:19:08 +02:00
Andre Klapper
01b5bf9ea1 Deprecate Fund and Phortune prototype applications
Summary: See T15726

Test Plan: Go to `/applications/` and see that Fund and Phortune say "Deprecated".

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25533
2024-02-06 09:16:19 +01:00
Andre Klapper
e3714c86a7 Validate PhabricatorSearchTextField value not to be an array
Summary:
PhabricatorSearchTextField.php's parent class PhabricatorSearchField.php defines an (empty) `protected function validateControlValue($value)`.
Override this function in PhabricatorSearchTextField.php by disallowing arrays (as the only data type which cannot be casted into a text value).

Closes T15714

Test Plan: Apply D25518; then manually edit the code in `ManiphestTaskSearchEngine.php` by defining an array and passing that array to the Page Size text field via `id(new PhabricatorSearchTextField())->setDefaultValue($empty_array)`, then go to `/maniphest/query/advanced/` and see the error message.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

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

Maniphest Tasks: T15714

Differential Revision: https://we.phorge.it/D25519
2024-02-05 22:41:54 +01:00
Andre Klapper
bb23e86daf Fix PHP 8.1 "json_decode(null)" exception editing a form when custom field of type Users exists
Summary:
When `$value` is `null`, do not pass `$value` down the stack in `buildControl()` to ultimately end up with `json_decode` complaining. Instead, just skip this call.

```
EXCEPTION: (RuntimeException) json_decode(): Passing null to parameter #1 ($json) 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=ae8cbe84252d)
  #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]
  #2 <#2> PhabricatorStandardCustomFieldPHIDs::setValueFromStorage(NULL) called at [<phorge>/src/infrastructure/customfield/field/PhabricatorCustomField.php:895]
  #3 <#2> PhabricatorCustomField::setValueFromApplicationTransactions(NULL) called at [<phorge>/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php:70]
  #4 <#2> PhabricatorCustomFieldEditField::buildControl() called at [<phorge>/src/applications/transactions/editfield/PhabricatorEditField.php:385]
```

Closes T15602

Test Plan: After applying these three changes and creating a custom field with `"type": "users"` 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: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15602

Differential Revision: https://we.phorge.it/D25390
2024-02-05 16:09:43 +01:00
Andre Klapper
25aebab655 Make misc get*ApplicationClass[Name]() calls return ::class constant instead of string
Summary:
`::class` is available since PHP 5.5 (5.5 is a minimal requirement by Phorge): https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
It makes finding code using IDEs easier; see discussion in D25500.

Thus replace all string return values with returning the `::class` constant instead, with one exception: 'PhabricatorSettingApplication' in `PhabricatorUserPreferencesSearchEngine.php` does not exist and makes arc lint fail so this string remained unchanged.

Also note that two occurrences were wrapped in `pht()` for reasons I do not know.

List of functions whose return value get updated in this code change:
* getApplicationClassName()
* getAdapterApplicationClass()
* getDatasourceApplicationClass()
* getEditorApplicationClass()
* getEngineApplicationClass()
* getPHIDTypeApplicationClass()
* getQueryApplicationClass()

cf. T15158

Test Plan: Too broad - click around, basically.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15158

Differential Revision: https://we.phorge.it/D25524
2024-02-05 14:11:36 +01:00
Aviv Eyal
d9919ddb06 Revert "Added cross-platform default fonts"
Summary:
Revert rPf8ffa393c4427f8b9026075e6dc490990a12df12 (D25021). This Commit caused more grief then fun.

Ref T15630

Test Plan: Site should still be readable on most platforms

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15630

Differential Revision: https://we.phorge.it/D25530
2024-02-04 23:14:59 +02:00
Andre Klapper
064424c1b7 Add getQueryApplicationClass() to *TransactionQuery.php classes
Summary:
Add `getQueryApplicationClass()` to all `*TransactionQuery.php` classes similar to other `*Query.php` classes having the same function, and make the parent function in `PhabricatorApplicationTransactionQuery.php` abstract.

In the future, this will enable excluding transaction query results based on their underlying application (for example if an application has been uninstalled) to mitigate the problem of overheated search results. See https://we.phorge.it/T15642 for context.

The only callers of `getQueryApplicationClass()` are in `src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php` and `src/applications/policy/__tests__/PhabricatorPolicyTestCase.php`.

See T15642

Test Plan:
Patch changes only one existing code place, thus check if related pages still work as expected:
* Go to http://phorge.localhost/feed/
* Go to http://phorge.localhost/feed/transactions/
* On http://phorge.localhost/feed/transactions/ , click `Edit Query` and set `Object Types` to `Application` etc.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15642

Differential Revision: https://we.phorge.it/D25500
2024-01-28 17:10:46 +01:00
Benjamin Kausch
87db482897 Adds "Locate File" input to every browse directory view in Diffusion
Summary:
Ref T15645

The very helpful "Locate File" input in Diffusion was so far only visible in the homepage route of any repository (`/repository`).

With this revision you can now locate a file from every browsed directory and in any selected commit.

The finder was already "directory sensitive" meaning: if you are trying to locate a file from within a browsed directory, only the children of this path will be searched.

For the searching in a specified commit (for example: https://we.phorge.it/source/phorge/browse/master/src/;05f4d5071fdca02123bd1ff4c0935b847c7f9963), I had to do a little JS magic adding the commit to the URI on the client side.

Test Plan: Checkout, browse through your repos with Diffusion trying to find files. (I tested only with Git repos.)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15645

Differential Revision: https://we.phorge.it/D25521
2024-01-28 12:51:35 +01:00
Andre Klapper
c0191a0392 Fix PHP 8.1 "strlen(null)" exception creating a Merchant in Phortune
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/phortune/provider/PhortunePaymentProvider.php:99]
```

Closes T15725

Test Plan: See steps in T15725

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15725

Differential Revision: https://we.phorge.it/D25528
2024-01-27 09:20:37 +01:00
Andre Klapper
7a86040f8a Avoid exception setting project profile image when GD not installed
Summary:
When trying to set a custom project profile image while the PHP GD extension is not installed, use the same logic which already exists in `PhabricatorFilesComposeAvatarBuiltinFile.php` to set the default project image. This stills display an unhelpful error message `This server only supports these image formats: .` but avoids an exception trying to call GD's `imagecreatefromstring()`.

```
EXCEPTION: (Error) Call to undefined function imagecreatefromstring() at [<phorge>/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php:131]
```

Closes T15326

Test Plan:
1. Remove the php-gd (and potentially gd) packages on your system; restart httpd
2. Go to http://phorge.localhost/project/manage/1/
3. Select `Edit Picture` in the sidebar on the right to go to the `Edit Project Picture` at http://phorge.localhost/project/picture/1/
4. Set a custom icon and color and click the `Save Image` button
5. Get `This server only supports these image formats: .` but no exception anymore

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

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

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

Maniphest Tasks: T15326

Differential Revision: https://we.phorge.it/D25515
2024-01-23 15:10:56 +01:00
Andre Klapper
7702772b2b preg_match() null exception setting custom user profile image with empty files.viewable-mime-types
Summary:
When `files.viewable-mime-types` is not set, `getViewableMimeType()` passes `null` to `preg_match()` which is deprecated behavior since PHP 8.1.
Only call `preg_match()` when there are some MIME types to compare.

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/storage/PhabricatorFile.php:974]
```

Closes T15710

Test Plan: Go to a user profile and try to upload a custom profile picture in BMP format.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15710

Differential Revision: https://we.phorge.it/D25516
2024-01-17 16:13:37 +01:00
Valerio Bozzolan
5de10185ce Config User Extra Fields: link to the doc (like Maniphest)
Summary:
Add a documentation link in a specific Config page, that is:

Config > Setting > user.custom-field-definitions

Test Plan:
Visit the page and click on the new link:

- /config/edit/user.custom-field-definitions/

Visit this page that was the inspirational page:

- /config/edit/maniphest.custom-field-definitions/

No nuclear implosions.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25507
2024-01-14 15:39:45 +01:00
Valerio Bozzolan
549a26d087 Auth SSH Details: show Public Key (not just Type)
Summary:
At the moment the "SSH Key Details" page lists only two minimal information:

- Key Type (Example: 'ssh-rsa')
- Created  (Example: 'Wed, Dec 13, 5:13 PM')

After this change it shows also the original Public Key. It becomes something like:

- Public Key (Example: 'ssh-rsa AAAB3....... mariana@localhost')
- Created    (Example: 'Wed, Dec 13, 5:13 PM')

This is just a minimal UX change.
Note that you can already see the Public Key by clicking "Edit".
So, nothing new is shown.

Context:

Premising that Phorge encourages to Revoke your decommissioned / deprecated
/ compromised SSH keys with a very lovely "Revoke" Workflow...

Root problem:

If you Revoke one of your keys, and if you then want to double-check that
SSH Public Key again (if you want to see its original body), you then discover
that you cannot see it anymore. In fact, the only way is the Edit button, but
Editing is disabled for any Revoked Key. In this kind of situation, it's not
nice to have to involve your favorite database administrator, to inspect the
'phabricator_auth.auth_sshkey' database table, to just be able to see your SSH
Public Key again.

After this change, you can easily self-audit your Revoked SSH Public Keys,
and your beloved DBA has extra free time. Win-win situation.

Closes T15692

Test Plan:
- visit your SSH Keys, open one, and check the new Details with your big eyes
- do the dame while juggling two ping pong balls (is anybody reading this?)
- do the same on a Revoked key

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15692

Differential Revision: https://we.phorge.it/D25495
2024-01-12 22:34:23 +01:00
Andre Klapper
8e09dbfee3 Fix PHP 8.1 exception creating 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.

```
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:14]
```

Closes T15691

Test Plan: After configuring a custom `select` field, try to create a task via a Maniphest form using that custom field.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15691

Differential Revision: https://we.phorge.it/D25494
2024-01-12 08:40:43 +01:00
Andre Klapper
40d10fbe1a Fix PHP 8.1 "strlen(null)" exception 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.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php:484]
```

Closes T15687

Test Plan:
Unknown. Definitely requires having custom fields defined, then playing with creating tasks using forms which expose these fields and going to `/maniphest/query/all/`.
See also D25487.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15687

Differential Revision: https://we.phorge.it/D25492
2024-01-12 02:04:50 +01:00
Valerio Bozzolan
6fe942a8f9 Add support for FIDO2-backed SSH keys
Summary:
U2F/FIDO are open standards for inexpensive two-factor authentication hardware that are widely used for website authentication.

These keys are available since OpenSSH 8.2 (2020-02-14).

https://www.openssh.com/txt/release-8.2

https://security.stackexchange.com/q/240991/260234

Ref Q96

Test Plan: Check the added keys. They exactly match the output of the command 'ssh -Q key'.

Reviewers: O1 Blessed Committers, antonia, avivey

Reviewed By: O1 Blessed Committers, antonia, avivey

Subscribers: avivey, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25508
2024-01-08 19:07:54 +01:00
Andre Klapper
d92ed9ce0c Hide "Packages" field in Diffusion Commits query form when application uninstalled
Summary: Fixes T15698

Test Plan:
1. Uninstall Packages via `/applications/view/PhabricatorPackagesApplication/`
2. Go to `/diffusion/commit/`, expand the Query form, and see that `Packages` is not shown anymore

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15698

Differential Revision: https://we.phorge.it/D25506
2024-01-06 16:26:01 +01:00
Andre Klapper
428f9686c4 Composing a custom project picture: Remove misaligned empty icon
Summary:
Do not assume that all items under `/resources/builtin/projects/` are image files (some can be subdirectories). Only add PNG files to the map.

Could be nicer to use `is_file()` or `is_dir()` but we are dealing only with string representations of files and folders.

Closes T15696

Test Plan: Go to `/project/picture/1/` and click the `Choose Icon and Color...` button; check last icon shown under "Choose Icon".

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15696

Differential Revision: https://we.phorge.it/D25499
2023-12-27 17:39:28 +01:00
Andre Klapper
2d997c3f10 Avoid "Undefined index" error in project.search API when project_customfieldstorage table has additional fields not requested
Summary:
Do not trigger an "Undefined index" error in PhabricatorCustomFieldStorage when calling the `project.search` Conduit API without passing search parameters when the local project_customfieldstorage table has additional fields configured not requested in the API call.

Closes T15688

Test Plan: See above; `curl -k -s -X GET http://phorge.localhost/api/project.search?api.token=api-xxxxxxxxxxxx | jq -r` for comparison

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

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

Maniphest Tasks: T15688

Differential Revision: https://we.phorge.it/D25493
2023-12-18 12:46:23 +01:00
Kuba Orlik
bd44ec833f Add example systemd unit for sshd in Diffusion docs
Summary:
The docs don't specify how to make the second sshd daemon start on every reboot.

I've added a unit that I use in my setup to the docs.

Ref T15467

Test Plan: Check that the docs look alright.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15467

Differential Revision: https://we.phorge.it/D25497
2023-12-18 10:55:09 +01:00
Kuba Orlik
be763d90ce Fix typo
Summary: This typo appeared in the docs and I thought I'd fix it

Test Plan: See that the typo at src/applications/config/option/PhabricatorCoreConfigOptions.php is gone

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25496
2023-12-18 10:50:35 +01:00
Andre Klapper
fe1122bd4d Catch RuntimeException: mb_convert_encoding(): Illegal character encoding specified at PhabricatorTextDocumentEngine.php:73
Summary:
When given `$encoding` is invalid, catch the exception to show a proper error message and make the server logs provide more hints.

```
EXCEPTION: (RuntimeException) mb_convert_encoding(): Illegal character encoding specified at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#1 <#2> mb_convert_encoding(string, string, string) called at [<phabricator>/src/applications/files/document/PhabricatorTextDocumentEngine.php:73]
```

Closes T15624

Test Plan: Open a URL which passes a bogus encoding value as parameter, like `/source/somerepository/browse/master/README.md?as=source&encode=TROLOLOL`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15624

Differential Revision: https://we.phorge.it/D25418
2023-12-17 11:42:21 +01:00
Valerio Bozzolan
2295bcda14 Curtain: add Hovercard support
Summary:
Before this change, the right navigation panel (Curtain) had info without Hovercard support.

After this change, all fields, like Subscribers, Tags, Referenced Files etc. have Hovercards.

If you meet an UX problem with a specific field with Hovercard, you can disable that specific
Hovercard, calling PHUICurtainObjectRefView::setHovercarded(false).

This is an example, now with Hovercard support:

{F342785}

Closes T15577

Test Plan:
No nuclear implosions when, on desktop and with a mouse:

Browse Maniphest Task and mouse hover Authored By, Assigned To, Subscribers, Referenced Files, ...

Browse Phriction document and mouse Tags, Referenced Files, Subscribers, ...

Browse single commit and mouse hover Referenced Files, Subscribers, ...

Browse Ponder question and mouse hover Tags, Referenced Files, Subscribers, ...

Browse Differential revision and mouse hover Tags, Referenced Files, Subscribers, ...

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15577

Differential Revision: https://we.phorge.it/D25424
2023-12-10 16:55:14 +01:00
Aviv Eyal
2ba2cbaf9b Show Deprecation Warnings as Setup Warnings
Summary:
Capture Deprecation Warnings, collect them into cache, and show them as a Setup Issue for admins to see and report back to us.

This only captures a sample of the traces, so not to overwhelm users (and RAM. and us) with reports.

Requires D25388. Refs T15554.

Test Plan: Run some flows that are known to bring up Deprecation Warnings. See them as a Setup Issue! Click little triangles to see details.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

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

Maniphest Tasks: T15554

Differential Revision: https://we.phorge.it/D25440
2023-12-08 17:55:18 +02:00
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