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

17651 commits

Author SHA1 Message Date
Andre Klapper
4bf5c452eb Improve error passing task IDs as URL parameter in invalid format
Summary:
Maniphest expects the values of the `ids` URL parameter to be integers. Example: http://phorge.localhost/maniphest/?ids=1,2,3,4 to show a list of tasks with those IDs.
When passing monograms instead (`T` prefix, like `T123` instead of `123`), a cryptic message `Expected a numeric scalar or null for %Ld conversion` is shown.

Thus check if `$this->taskIDs` consists of integers only; if not throw a `PhutilSearchQueryCompilerSyntaxException` with an explanatory error message.

Closes T15838

Test Plan: Go to http://phorge.localhost/maniphest/?ids=T1,T2,T3,T4 before and after applying the patch.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15838

Differential Revision: https://we.phorge.it/D25669
2024-05-29 12:11:10 +02:00
Andre Klapper
40b1e6b17a PHPMailer: Remove unused variable
Summary: `$tmp` is declared but never used.

Test Plan: Read/grep the code.

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/D25665
2024-05-28 08:35:47 +02:00
Pppery
3a6e835e36 Fix spelling of etc. in messages per Translatewiki request
Summary: Closes T15839

Test Plan: Read the code and see that it is spelled correctly

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15839

Differential Revision: https://we.phorge.it/D25670
2024-05-25 11:51:48 -04:00
Andre Klapper
67c0efdffb PHPMailer: Remove duplicate array keys
Summary:
`'doc'` is listed twice in the `$mimes` array. Remove one key.

The second key was also removed in 6f919df65e.

Test Plan: Read/grep the code.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25666
2024-05-21 11:07:39 +02:00
Andre Klapper
a579a974eb PHPMailer: Remove use of each() function removed in PHP 8.0
Summary:
`each()` has been deprecated since PHP 7.2 and got removed in PHP 8.0 per https://www.php.net/manual/en/function.each.php

Replace it with a `foreach` construction.

Closes T15833

Test Plan: Carefully read the code; locally testing that construction per D25659#18155; compare to similar rP9623e667458821f696eb92e9dac5a2c9720af7af

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15833

Differential Revision: https://we.phorge.it/D25659
2024-05-19 13:10:12 +02:00
Andre Klapper
601ac45032 PHPMailer: Remove check for non-existing get_magic_quotes()
Summary: No idea if PHP ever offered such a method. In any case, this very check was removed in 6f919df65e (diff-2d294eae28fb0d70fc32da8369c4fe33d301c99ca3eeb4bd41da18ad99344d68) in 2012.

Test Plan: Not sure - how to test a removed check for a method which does not exist anyway? :)

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25663
2024-05-19 10:20:00 +02:00
Andre Klapper
c1a8b83bd7 Correct PHPDoc or add default return for numerous methods
Summary:
Correct PHPDoc when none of the method calls try to handle a return value.
Add missing fallback `return` statements (which may never be reached if previous condition checks were always true).

This reduces the amount of errors reported by static code analysis tools.

Test Plan: Carefully read the code and check all places in which a function gets called whether a return value is expected.

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/D25650
2024-05-18 21:54:51 +02:00
Andre Klapper
23a3f59be2 Fix typo creating QRbitstream()
Summary:
Make the one `new QRbitrtream()` look like the other nine `new QRbitstream()`.

Interestingly, this bug was reported upstream since 2018, and still not fixed:

https://github.com/t0k4rt/phpqrcode/issues/47

Test Plan:
Read the code aloud and realize that this word sound weird.

Verify that the class `QRbitrtream` does not exist, and `QRbitstream` exists.

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/D25651
2024-05-18 21:45:09 +02:00
Andre Klapper
8c82117878 Fix PonderQuestionCreateMailReceiver accessing non-existing PonderQuestionTransaction constants
Summary:
The transaction types `TYPE_TITLE` and `TYPE_CONTENT` were removed from `PonderQuestionTransaction` in rPdff028c4907dd1959859733ea0d947f244559e7f.
Thus update `PonderQuestionCreateMailReceiver` to use the corresponding modular transactions `PonderQuestionTitleTransaction` and `PonderQuestionContentTransaction` instead.

Test Plan: Carefully read the code, grep the code base, use the test case in D25656#18162.

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/D25656
2024-05-18 21:41:04 +02:00
Valerio Bozzolan
b8a03bc145 Workboard Trigger Rule: allow to Add/Remove Subscribers
Summary:
This is a natural expansion of the Workboard Trigger system
to support actions about Subscribers.

Context: even before this change - Workboard users
were already able to move Tasks to Columns with
nice automatisms. For instance, you can already:

- Play a nice Sound
- Change Task Priority
- Change Task Status
- Add or Remove a Task Owner
- Add or Remove a Task Project Tag

With this change, you can also:

- Add or Remove Task Subscribers

If you need inspiration, this feature is useful for adding
more eyes on a given work area; lighten the notifications
of certain people after certain workflows have already been
done, to increase happiness and mitigate Burnout.

If your goal is to oppress yourself or your coworkers - of
course you can also use this feature to increase the Burnout
of yourself or your coworkers, adding random people as
Subscriber.

Note: every trigger action can be confusing in general, but
it is the fault of Triggers in general and not related to
this specific feature - that is totally loveable,
just like you.

Closes T15162

Test Plan:
- Workboard > Column > Create Trigger
- Add Action > Add Subscriber > (your best friend who hates NodeJS)
- Add Action > Remove Subscriber > (your antagonist who hates PHP)
- Move some Tasks there and here, and note that Add/Remove works

Reviewers: O1 Blessed Committers, Cigaryno, aklapper

Reviewed By: O1 Blessed Committers, Cigaryno, aklapper

Subscribers: aklapper, speck, tobiaswiese, Matthew, Cigaryno

Tags: #workboard

Maniphest Tasks: T15162

Differential Revision: https://we.phorge.it/D25080
2024-05-18 10:15:58 +02:00
Valerio Bozzolan
f4d9d6920b The feed "created this task" should be the first one
Summary:
Create a Maniphest task, Resolved, High priority.

Before this change, this was the feed in the object page:

- a.lincoln closed this task as Resolved.
- a.lincoln triaged this task as High priority.
- a.lincoln __created this task__.

After this change, this is the feed:

- a.lincoln __created this task__.
- a.lincoln closed this task as Resolved.
- a.lincoln triaged this task as High priority.

This also improves the situation in the /feed/ page. So you see the creation now.

Ref T15816

Test Plan:
Create an object in any mentioned application below, setting all fields.

Then, check the history of the object itself. Check also the /feed/ page.
Check that the creation action is now listed first.

This change improves the situation in:

- Maniphest
- Phriction

This change has no impact on these that seem already OK:

- Calendar
- Dashboard
- Dashboard Panel
- Diffusion
- Macro
- Paste
- Ponder
- Project
- Pholio

This change has no impact on these that seem still in the wrong order:

- Differential

The above situation in Differential is noted, but it's unrelated,
since it has a different legacy structure and it deserves more triaging.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15816

Differential Revision: https://we.phorge.it/D25626
2024-05-18 10:05:35 +02:00
Andre Klapper
a6499aee0e PHPMailer: Remove a check for PHP 5.0
Summary:
Phorge requires PHP 5.5, thus remove a version check for PHP 5.0.
Compare the same code in https://github.com/PHPMailer/PHPMailer/blob/master/src/POP3.php#L282-L283

Test Plan: Carefully read the code.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25661
2024-05-18 02:00:28 +02:00
Andre Klapper
e6925c83c1 Do not hardcode default Priority names in Project Reports tooltip
Summary:
Pull the names of Priority field values instead of hardcoding them.

Closes T15799

Test Plan:
* As an admin, go to `/config/edit/maniphest.priorities/` and change the value of `"name"` of a Priority value with a value < `50` (e.g.: Low, Wishlist)
* Open `/maniphest/report/project/`
* Hover over the `Oldest (Pri)` column and check the tooltip text before and after applying this patch

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15799

Differential Revision: https://we.phorge.it/D25602
2024-05-17 09:16:10 +02:00
Andre Klapper
d5295da072 Remove deprecated buildStandardPage* method calls
Summary:
Remove deprecated `buildStandardPageView()` and `buildStandardPageResponse()` methods.
They have been deprecated since rP300c74c49dc9d9f3ef1d7bbcc1b2400a3ded0c41 in November 2015.
cf rPd26cca27d70b69080c10e1df92a10419fffbfc7e, rP1b00ef08a039d48adb6bbbcd6956f900b6303b5b.

Test Plan: Compare http://phorge.localhost/xhpast/ before and after; paste and parse some PHP code into http://phorge.localhost/xhpast/; compare resulting http://phorge.localhost/xhpast/view/1/ before and after. Spot no differences and see no errors in DarkConsole.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25634
2024-05-16 08:39:08 +02:00
Andre Klapper
50d0bbe8ff Fix PHP 8.1 "strlen(null)" exception rendering files/documents
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/document/render/PhabricatorDocumentRenderingEngine.php:211]
```

Closes T15826

Test Plan: Surf a Diffusion repository and play with {nav View Options}.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15826

Differential Revision: https://we.phorge.it/D25638
2024-05-15 17:30:58 +02:00
Andre Klapper
464a0aedc4 Fix PHP 8.1 "strlen(null)" exception in PhabricatorAuthStartController.php
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/controller/PhabricatorAuthStartController.php:34]
```

Closes T15832

Test Plan: Run `arc unit` locally, probably also don't be logged in.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15832

Differential Revision: https://we.phorge.it/D25639
2024-05-15 14:45:34 +02:00
Andre Klapper
8a3b70aa7d Run ./bin/celerity map after previous commit
Summary: Followup to rP67b7181f522673b05435083ce28106bdfa320e18

Test Plan: Run `./bin/celerity map` and see changes due to my previous commit.

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/D25637
2024-05-13 19:00:03 +02:00
Andre Klapper
67b7181f52 Facts: Always render YYYY-MM-DD dates with eight digits in chart tooltips
Summary:
Always render dates in tooltips when hovering over data points in Burndown charts etc of the Facts application as `YYYY-MM-DD` instead of `YYYY-M-D` by converting the integer to a string and if its length is only one character, prepend a zero.

Closes T15819

Test Plan:
* Enable the Facts application, go to the Reports of a Project with task changes over time, hover over data points and read the tooltip.
* Check Console of web browser's developer tools for no errors.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15819

Differential Revision: https://we.phorge.it/D25630
2024-05-12 10:19:25 +02:00
Aviv Eyal
ea554af476 Add (Advanced) Custom Fields to Item List
Summary:
Allow PHP-coded Custom Fields to show things in Lists.

Also add Repository to Revision List and Flags to Maniphest lists.

Closes T15133. Ref T15512, T15750

Test Plan: Look at Repository List and Task lists that have flags.

Reviewers: O1 Blessed Committers, aklapper, valerio.bozzolan

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

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

Maniphest Tasks: T15750, T15512, T15133

Differential Revision: https://we.phorge.it/D25548
2024-05-11 13:25:41 +03:00
Andre Klapper
f2a01dca39 Fix PHP 8.1 "strlen(null)" exception checking for open setup issues in PhabricatorSetupCheck
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/config/check/PhabricatorSetupCheck.php:125]
```

Closes T15823

Test Plan: Run `./bin/cache purge --all`, check any Phorge page in browser before and after applying this patch.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15823

Differential Revision: https://we.phorge.it/D25633
2024-05-10 18:16:12 +02:00
Valerio Bozzolan
b6f132f04f TransactionEditor: micro-optimize the "creation finder"
Summary:
The foreach starting at old line 1305-1311 was designed to look for a specific transaction type.

When we have found that, let's stop that loop, so, we save some CPU cycles.

Test Plan:
Note that getTransactionType() has not side-effects.

Test some applications - like Pholio - that use the TransactionEditor:

- Create a new Pholio and Save
- Save it again without changes.
- Save it again with changes.

Everything still working normally.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25627
2024-05-09 18:40:50 +02:00
Valerio Bozzolan
6514598f66 Dashboard Text Panel: improve feed when changing Description
Summary:
When creating a Dashboard Text Panel, from example from here:

http://phorge.localhost/dashboard/panel/edit/?panelType=text

After you change its Description,

Before this change, this was the feed (but you must have Developer Mode):

    foo.bar edited this object (transaction type "text.text").

After this change, this is the feed:

    foo.bar edited the the panel text. (Show Details)

So, not only we show a nice title, but we also allow to see details.

| Before     | After      |
|------------|------------|
| {F2182938} | {F2182943} |

Credits:

- LegalpadDocumentTextTransaction for the getTitle() method
- ManiphestTaskDescriptionTransaction for the details

Closes T15817

Test Plan:
- Create a Text Panel from /dashboard/panel/edit/?panelType=text
- Change description
- See the new feed
- Click on "Show Details". Also that works. You see A/B changes.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15817

Differential Revision: https://we.phorge.it/D25625
2024-05-09 18:40:20 +02:00
Andre Klapper
61c953268e Fix PHP 8.1 "strlen(null)" exception rendering Conpherence 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.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php:154]
```

See also similar rPe65ac7b8800d3397abfced7824a8d316ec573d8f

Closes T15818

Test Plan: Go to http://phorge.localhost/conpherence/search/query/all/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15818

Differential Revision: https://we.phorge.it/D25629
2024-05-09 14:42:13 +02:00
Valerio Bozzolan
5b90567f64 Persistent Chat: fix de-minimize misclick
Summary:
When the persistent chat is minimized to the bottom of your window, as mentioned in T15626,
the chat bar still has an invisible square area that does nothing if you click it by mistake:

{F2184778}

That area was reserved for the Settings Icon, that appears only if you de-minimize the chat.

The Settings Icon was toggled incorrectly from CSS. It was just hiding the Font Awesome icon,
(.fa-gear), instead of hiding its clickable container.

After this change, chat can be de-minimized even if you click in that specific evil spot.

Original credit to @roberto.urbani for the original troubleshooting and original patch.

Follow-up from: D25428

Closes T15626

Test Plan:
Show the Chat, then:

- when the chat is de-collapsed:
    - you see the Settings icon (as before)
    - you can click on the Settings Icon (as before)
    - it shows the Settings menu (as before)
- when the chat is collapsed:
    - you can click in whatever point, and it de-collapse (better than before)

Additionally, use the HTML inspector in your browser (`F12` from Firefox),
to double-check that now that `<li>` has display: none when the chat is collapsed.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno, roberto.urbani

Maniphest Tasks: T15626

Differential Revision: https://we.phorge.it/D25628
2024-05-09 13:56:18 +02:00
Andre Klapper
aad704d0fc Mark created Pholio mockups as new objects to fix empty Feed transaction entries
Summary:
When creating a Pholio mockup, `setIsCreateTransaction(true)` to avoid an empty `Transaction` field in the Feed and avoid `strncmp()` complaining about a null value being passed.

This is very similar to T15659 about Differential Diffs.

```
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 T15679

Test Plan:
1. Create a new Pholio mockup via `/pholio/create/`
2. Go to `/feed/transactions/query/all/`
3. Compare entries in the `Transaction` column before (empty ones) and after (no empty ones) applying the patch.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15679

Differential Revision: https://we.phorge.it/D25600
2024-05-09 11:04:37 +02:00
Perry
29cbb0a658 Make i18n string extraction ignore strings in test case files
Summary:
Do not extract strings from test case files for localization / translation.
They are not exposed to users, and localizing wastes translators' time.

Closes T15815

Test Plan:
* Install Wikimedia downstream `translations` extension via `git clone https://gerrit.wikimedia.org/r/phabricator/translations` and put it on the same filesystem level as `phorge` and `arcanist`, and follow https://we.phorge.it/w/docs/extensions/install/
* Apply https://gerrit.wikimedia.org/r/c/phabricator/translations/+/1028887 on top, to make the `translations` extension work with upstream Phorge.
* In the downstream `translations` extension path, run `./export.sh`, then run `grep -r "__tests__" .` and get a list of `qqq.json` files with context for strings from test files.
* Apply this patch.
* In the downstream `translations` extension path, run `./export.sh`, then run `grep -r "__tests__" .` to verify that no `qqq.json` files include any strings from test files anymore.

Reviewers: O1 Blessed Committers, aklapper, avivey

Reviewed By: O1 Blessed Committers, aklapper, avivey

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

Maniphest Tasks: T15815

Differential Revision: https://we.phorge.it/D25624
2024-05-08 10:58:32 -04:00
Andre Klapper
af300016b6 Fix exception trying to rename user to their previous username
Summary:
When trying to rename a user, properly handle when the new username is the old username to avoid an exception.

```
EXCEPTION: (PhabricatorApplicationTransactionNoEffectException) Transactions have no effect:
  - Transaction (of type "user.rename") has no effect. at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2823]
```

Closes T15795

Test Plan:
* As an admin, go to `/people/manage/123/` and select `Change Username`. Use the old username as the new username and select `Rename User`. Without the patch, get an exception. With the patch, get a proper error message within the dialog, as if you tried to set the new username to an empty string.
* As an admin, go to `/people/create/`, select `Create Standard User`, and successfully create a new user account.
* In an anonymous browser window, go to `/auth/start/`, click `Register New Account`, and successfully create a new user account.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15795

Differential Revision: https://we.phorge.it/D25601
2024-05-07 16:21:00 +02:00
9a5643253b
docs/file_domain: Update cloudflare spelling and URLs
Summary:
Cloudflare now spell themselves as `Cloudflare`.[1]

[1]: https://www.cloudflare.com/trademark/

Signed-off-by: Yongmin Hong <revi@omglol.email>

Test Plan: Read the Docs ™️.

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/D25616
2024-05-07 13:01:39 +00:00
Andre Klapper
960a1ab1ec Facts: Fix displaying charts for anonymous users
Summary:
Charts in the Facts prototype application (e.g. as a Burndown chart on a project's Reports page) remained empty for users not logged in: payload response was a login dialog instead of actual data to render. Thus set `shouldAllowPublic()` (as for many other Controllers).

Closes T15436

Test Plan:
* As an admin, enable the Facts prototype application.
* As an admin, set "Can Use Application" to "Public" for Projects on http://phorge.localhost/applications/view/PhabricatorProjectApplication/
* As an admin, set "Can Use Application" to "Public" for Facts on http://phorge.localhost/applications/view/PhabricatorFactApplication/
* Go to a project with tasks; select "Reports (Prototype)" in the sidebar
* Both as a logged in and as an anonymous user, check if the charts render.
* Click the `View Chart` option and both as a logged in and as an anonymous user, check if the charts render at an URI like http://phorge.localhost/fact/chart/a1b2c3d4e5f6/
* As an admin, restrict "Can Use Application" to "Users" for Facts on `/applications/view/PhabricatorFactApplication/`
* As an anonymous user, check that http://phorge.localhost/fact/chart/a1b2c3d4e5f6/ requires a login now.
* As an anonymous user, check that charts on http://phorge.localhost/project/reports/1/ remain empty boxes (which is not ideal but not a big difference to beforehand).

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15436

Differential Revision: https://we.phorge.it/D25608
2024-05-05 17:35:35 +02:00
Waldir Pimenta
c8fb504690 Fix the whitespace issue in the message "Access Denied: Restricted File"
Summary:
Added whitespaces where missing in the restricted file message.

Closes T15270

Test Plan: Access a forbidden file. Check whitespaces in the error message.

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

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

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

Tags: #ux

Maniphest Tasks: T15270

Differential Revision: https://we.phorge.it/D25419
2024-05-05 14:00:26 +03:00
Andre Klapper
81653abb54 Fix PHP 8.1 "strlen(null)" exceptions adding an OAuth provider
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

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

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

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

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

Closes T15786

Test Plan: Set up any Auth provider which uses OAuth2 and check the error console.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15786

Differential Revision: https://we.phorge.it/D25578
2024-05-03 15:10:19 +02:00
Andre Klapper
84c57f5e57 Fix exception trying to export empty task list to CSV
Summary:
Check that we have objects with PHIDs before running a query. If there are none, return an empty array instead.

```
EXCEPTION: (Exception) Edge list passed to "withSourcePHIDs(...)" is empty, but it must be nonempty. at [<phorge>/src/infrastructure/edges/query/PhabricatorEdgeQuery.php:50]
```

Closes T15789

Test Plan:
* Log into Phorge, go to http://phorge.localhost/maniphest/query/assigned/ and make sure you have zero assigned tasks.
* Click "Use Results" and select "Export Data".
* In the "Export Results" dialog, keep default Format = csv and click "Download Data".
* After applying the patch, get the expected dialog "Download File - Download file assigned.csv (264 B)?" and resulting file with only column headers and no data, instead of an unhandled exception.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15789

Differential Revision: https://we.phorge.it/D25613
2024-05-02 10:29:14 +02:00
Andre Klapper
279ed1ee76 Fix PHP 8.1 "strlen(null)" exception in PhabricatorPasteLanguageTransaction.php
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

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

Closes T15808

Test Plan: Unknown. Given that the function rendering `$value` is later called to construct a title string passed to `pht()` I assume that it should be a string and not a scalar.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15808

Differential Revision: https://we.phorge.it/D25611
2024-05-02 10:28:08 +02:00
Andre Klapper
488960ae7a Fix PHP 8.1 "strlen(null)" exception in PhabricatorStandardCustomFieldLink.php
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

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

Closes T15807

Test Plan: Unknown. Given that `$value` is later used to construct a `phutil_tag` I assume that it should be a string and not a scalar.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15807

Differential Revision: https://we.phorge.it/D25610
2024-05-02 10:26:13 +02:00
Andre Klapper
fbe07fbeef Convert "Page Size" field in Maniphest Advanced Search to PhabricatorSearchIntField
Summary:
Convert the "Page Size" field from PhabricatorSearchTextField to PhabricatorSearchIntField as its input should be an integer value (the number of tasks to display in the query results).

Closes T15723

Test Plan:
* Go to `/maniphest/query/advanced/`
* enter random values in the `Page Size` field and run random Maniphest queries (example values:  `13`, `0`, `-13`, `foobar`, `foo13bar`, `-foo1313`, `13.5`, `-13.5`, `13,5`, `-13,5`, `-`, `-0`).

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15723

Differential Revision: https://we.phorge.it/D25527
2024-05-02 10:16:14 +02:00
Andre Klapper
74e28bc2a7 Reports: Remove unused variable
Summary: This variable feels unneeded in this function. It may have a better and more fulfilling life after finding a new function.

Test Plan: Read slowly and aloud all code in the function.

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/D25609
2024-05-01 11:44:27 +02:00
Andre Klapper
2cc94023ff Update URI in bugtraq.logregex description
Summary: HTTPS makes the world a safer place.

Test Plan: Go to `/config/edit/bugtraq.logregex/` and click the URI in the description. Carefully compare what you clicked and where you ended up. Perhaps the real treasure was the friends you made along the way?

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/D25606
2024-05-01 11:42:26 +02:00
Andre Klapper
6ab2b56a1a PhutilRemarkupHexColorCodeRule: Do not assume that parameter is a string
Summary:
Check type before potentially mangling HTML in a PhutilSafeHTML element.
For now, do not try to apply this renderer when not dealing with a plain string.

Closes T15802

Test Plan: After deleting the corresponding MarkupCache via `DELETE FROM phabricator_cache.cache_markupcache WHERE cacheData LIKE "%whatever description on the page%";` check the description of a page, e.g. of `/config/edit/security.require-https/` or `/config/edit/storage.default-namespace/`.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15802

Differential Revision: https://we.phorge.it/D25605
2024-04-30 09:28:20 +02:00
Valerio Bozzolan
3367fe0017 Drag & Drop Task Cover Image: also attach
Summary:
After this change, the cover image is finally always visible to others (to people who can see the Task)
instead of being visible only to yourself.

Example conversation before this change:

- Anna: (uploads a nice Cover Image on the Task, using drag & drop from the Workboard)
- Bob: Thanks! But I cannot see that image. Please change visibility.
- Anna: Ouch! How?
- Bob: I don't know. Try Files > your File > Edit > Set Visibility > Something that includes "Bob".
- Anna: Done. Do you see my image now? (Spoiler: it's a green pepper)
- Bob: Yes and no. I mean, I can see the original file, but not from the Workboard.
- Anna: Uh? Have you tried refreshing your cache?
- Bob: Yes. Still invisible from Workboard.
- Anna: Maybe you have to change Defaults Permissions of the "Files" Application, to have "All Users"
- Bob: That is a bit invasive. Let's try. I changed the Files policy globally. Try re-uploading your image again.
- Anna: Done. Do you see it now?
- Bob: Yes! I can finally see it now, also from the Workboard.

Example conversation after this change:

- Anna: (uploads a nice Cover Image on the Task, using drag & drop from the Workboard)

Done! So, after this change, everything works as expected. Every task participant can see that image,
and nobody starts a nonsense conversation, and nobody needs to do random experiments with
default application policies.

So, after this change:

- the original file is attached to the Task
- the cover image is not orphan anymore, but mentioned in the "Transforms" of the original file
- the cover image so now inherits the original file policies

So, Task participants can finally see that cover image (transform), since it comes from a file,
and that file is attached to the Task, and since they can see that Task.

For a micro-optimization, this change refactors a bit PhabricatorFile.

You can still work in object-oriented:

    lang=php
    $file->attachToObject($task_phid);

But now you can also work directly with PHIDs, if necessary:

    lang=php
    PhabricatorFile::attachFileToObject($file_phid, $task_phid)

This patch somehow improves T15768.

Closes T15163
Closes T15703

Test Plan:
Visit a Workboard with a Column and a Task. Then:

1. Drag & Drop GNU.png from your computer to that Task
2. Drag & Drop GNU.png again there
3. Drag & Drop Linux.png to that Task
4. Drag & Drop Linux.png again
5. No nuclear implosion.
6. In all cases Task participants can see your Cover Image.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15163, T15703

Differential Revision: https://we.phorge.it/D25475
2024-04-29 17:34:40 +02:00
Aviv Eyal
f75c7ce766 arc liberate
Summary: See Q134; Introduced in D25598.

Test Plan: unit tests

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

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

Differential Revision: https://we.phorge.it/D25603
2024-04-28 19:54:13 +03:00
Andre Klapper
4da88848be Fix exception accessing a non-existing EditEngine
Summary:
Trying to access a non-existing edit engine "foo" via the URI `/transactions/editengine/foo/` throws an unhandled exception.
`PhabricatorEditEngine::getByKey($viewer, $engine_key)` is null as `$engine_key` is non-existing `foo`.
Thus avoid calling `setViewer()` on `null` by splitting into a separate step after a null check.
When null, show a proper 404 error instead.

```
EXCEPTION: (Error) Call to a member function setViewer() on null at [<phorge>/src/applications/transactions/controller/PhabricatorEditEngineConfigurationListController.php:17]
```

Closes T15793

Test Plan:
While logged in and with sufficient permissions,
* go to non-existing http://phorge.localhost/transactions/editengine/whatever/ before and after applying patch,
* go to existing http://phorge.localhost/transactions/editengine/maniphest.task/ to see that existing stuff still works.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15793

Differential Revision: https://we.phorge.it/D25597
2024-04-26 14:33:29 +02:00
Andre Klapper
93c7444d5c Fix PHP 8.1 "strlen(null)" exception mass-editing tasks when custom Date field present
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/PhabricatorStandardCustomFieldDate.php:113]
```

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

Closes T15794

Test Plan:
Define a date field in maniphest.custom-field-definitions, have more than 100 Maniphest tasks, and select some to bulk-edit them. Example config:

    lang=json
    {
      "mycompany.deadline": {
        "name": "Deadline",
        "type": "date",
        "caption": "Estimated deadline.",
        "search": true
      }
    }

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15794

Differential Revision: https://we.phorge.it/D25599
2024-04-26 13:00:24 +02:00
Andre Klapper
b32b84b645 Fix exception for anonymous viewers on dashboard query panels with user-specific data
Summary:
When a viewer is not logged in and opens a public dashboard which embeds a query panel whose data requires a Current Viewer context (e.g. assigned or authored tasks, or joined projects), do not throw an exception but show an explanatory placeholder sentence (similar to already existing 'No tasks found.' or 'No documents found.' strings).

```
EXCEPTION: (Exception) Query "assigned" is unknown to application search engine "ManiphestTaskSearchEngine"! at [<phorge>/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php:80]
EXCEPTION: (Exception) Query "joined" is unknown to application search engine "PhabricatorProjectSearchEngine"! at [<phorge>/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php:80]
```

Closes T15792

Test Plan: While logged in, set up a dashboard query panel with "Search For: Maniphest Tasks" and "Query: Assigned" and add it to a public Dashboard. While logged out, access the Dashboard and see explanation message instead of `Exception: Query "assigned" is unknown to application search engine "ManiphestTaskSearchEngine"!` on the dashboard.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15792

Differential Revision: https://we.phorge.it/D25598
2024-04-26 12:54:35 +02:00
Mukunda Modell
4d12d014fd Add PhutilRemarkupHexColorCodeRule, a new remarkup rule to format color codes
Summary:
Implements a remarkup rule that formats the background color to match the value of inline hex color codes.

The format for this rule looks like `{#RRGGBB}` and it will be formatted the same as monospace text, so `#RRGGBB` with the background set to the specified color.

Test Plan:
* run `arc unit` and see the tests pass
* create some markup with {#ff0000} color codes for all of your favorite colors {#ee33ee}

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15744

Differential Revision: https://we.phorge.it/D25540
2024-04-23 16:45:10 -05:00
Andre Klapper
5444e1c885 Fix PHP 8.1 "strlen(null)" exception for "/bin/storage renamespace" 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/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php:62]
```

Test Plan: Run `../phorge/bin/storage renamespace`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify the dumpfile to read with "--input", or use "--live" to generate one automatically.`

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/D25592
2024-04-17 13:12:40 +02:00
Andre Klapper
5fe2fc33fb Fix PHP 8.1 "strlen(null)" exception for "/bin/almanac register" 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/almanac/management/AlmanacManagementRegisterWorkflow.php:41]
```

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

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/D25591
2024-04-17 13:12:16 +02:00
Andre Klapper
db3e68137d Fix PHP 8.1 "strlen(null)" exception for "/bin/aphlict notify" 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/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php:29]
```

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

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/D25590
2024-04-17 13:11:07 +02:00
Andre Klapper
85903f968f Fix PHP 8.1 "strlen(null)" exception for "/bin/bulk export --query --format" 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/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php:167]
```

Test Plan: Run `../phorge/bin/bulk export --query --format`: Get no `strlen()` error anymore but only expected output `Usage Exception: Query "--format" is unknown. To run a builtin query like "all" or "active", also specify the search engine with "--class".`

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/D25588
2024-04-17 13:10:10 +02:00
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