Summary:
`preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1.
Thus add a `phutil_nonempty_string()` check if the `$subject` parameter is a non-empty string.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=18554ea76ceb), phorge(head=diffAttach, ref.master=e11c5486c92b, ref.diffAttach=e11c5486c92b)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#1 <#2> preg_match(string, NULL, NULL) called at [<phorge>/src/applications/differential/editor/DifferentialTransactionEditor.php:221]
```
Closes T15431
Test Plan: After applying this change on top of D25262, going to `/differential/diff/create/`, creating a diff, and entering nothing on the "Create Revision" page on `/differential/revision/attach/1/to/` correctly shows the errors "You must provide a test plan. Describe the actions you performed to verify the behavior of this change. Revisions must have a title." in web browser instead of an exception.
Reviewers: O1 Blessed Committers, speck
Reviewed By: O1 Blessed Committers, speck
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15431
Differential Revision: https://we.phorge.it/D25263
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=HgViewBranches, ref.master=cb938d869c3f, ref.HgViewBranches=cb938d869c3f)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php:83]
```
Closes T15447
Test Plan: After applying this change, going to `/diffusion/1/branches/default/` shows an expected FilesystemException instead of the previous RuntimeException.
Reviewers: O1 Blessed Committers, speck
Reviewed By: O1 Blessed Committers, speck
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15447
Differential Revision: https://we.phorge.it/D25279
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=SvnRepoMain, ref.master=cb938d869c3f, ref.SvnRepoMain=cb938d869c3f)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionController.php:156]
```
Closes T15446
Test Plan: After applying this change, going to a newly created SVN repository at `/diffusion/1/`, the page renders, showing the repository as Inactive and also "Empty Repository - This repository does not have any commits yet." as expected.
Reviewers: O1 Blessed Committers, speck
Reviewed By: O1 Blessed Committers, speck
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15446
Differential Revision: https://we.phorge.it/D25278
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=diffusionCreateRepoURI, ref.master=d8d65f3f87ed, ref.diffusionCreateRepoURI=d8d65f3f87ed)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/repository/storage/PhabricatorRepositoryURI.php:755]
```
Closes T15444
Test Plan: After applying this change and setting a repo URI following the steps in T15444, the page "R10: URI 58" on `/diffusion/10/uri/view/58/` is correctly rendered without an exception.
Reviewers: O1 Blessed Committers, speck
Reviewed By: O1 Blessed Committers, speck
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15444
Differential Revision: https://we.phorge.it/D25273
Summary:
As of PHP ~v8 the zip_open and associated functions have been deprecated and
removed. The replacement is the ZipArchive API. This updates the figlet
implementation to use this API which has been present in PHP since 5.2.
Additionally in PHP 8 the use of squiggly brackets for indexing into arrays
is also deprecated. This updates to remove two uses of squiggly brackets and
replace with square brackets.
These two deprecations would result in being unable to load differential
revisions in which someone had commented using figlet remarkup.
Imported from:
https://secure.phabricator.com/rPd5c63c86e7e4e87d5f72b35b1bdb1e888aea49bchttps://secure.phabricator.com/rPbc6f4786a2e36441d17b765fde8e8e047840bc58
Closes T15289
Test Plan:
Applied these changes to an install and loaded a revision that had comments
where someone utilized figlet remarkup. The revision loaded properly and the
figlet comment rendered properly.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15064, T15289
Differential Revision: https://we.phorge.it/D25142
Summary:
Add `./bin/celerity sprites`, to replace script `./scripts/celerity/generate_sprites.php`.
Also make new workflow run `./bin/celerity map` at the same time.
Fixes T15437.
Test Plan: Changes a file that goes in the sprites, run new command
Reviewers: O1 Blessed Committers, speck
Reviewed By: O1 Blessed Committers, speck
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15437
Differential Revision: https://we.phorge.it/D25274
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=b325304b6e52), phorge(head=uiExamples, ref.master=dd24c94b0741, ref.uiExamples=dd24c94b0741)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarSegmentView.php:58]
```
Closes T15441
Test Plan:
After applying this change, going to `/uiexample/view/PhabricatorAphrontBarUIExample/`,"Bars (PhabricatorAphrontBarUIExample)" renders with beautiful colors.
To see that page, enable prototypes with:
./bin/config set phabricator.show-prototypes true
Also try to create a Milestone on a Project, with the Config `maniphest.points` enabled, and try to create some Tasks with different points. Visit its Workboard to see the bar that still works with a useful tooltip.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15441
Differential Revision: https://we.phorge.it/D25272
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=18554ea76ceb), phorge(head=diffDiff, ref.master=e11c5486c92b, ref.diffDiff=e11c5486c92b)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php:160]
```
Closes T15430
Test Plan:
After applying these two changes, going to `/differential/diff/create/`, pasting the content of a diff file into the "Raw Diff" field, and selecting the "Create Diff" button, `/differential/diff/1/` rendered correctly in web browser.
Also, install xdebug and try again with coverage mode enabled in your php.ini of your PHP cli.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15430
Differential Revision: https://we.phorge.it/D25262
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=e4fd31ec024e), phorge(head=D25241, ref.master=b1edfea09bad, ref.D25241=b1edfea09bad)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/controller/DiffusionBranchTableController.php:29]
```
```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=e4fd31ec024e), phorge(head=D25241, ref.master=b1edfea09bad, ref.D25241=b1edfea09bad)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php:33]
```
Closes T15414
Test Plan: Applied these two changes and at least got to `(FilesystemException) Filesystem path "/var/repo/1/" does not exist.` as an error message, instead of being stuck at `(RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated`.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15414
Differential Revision: https://we.phorge.it/D25241
Summary:
Fix a loose comparison causing a bug when comparing the selected tab (0) with a tab which has an alphanumeric ID which doesn't begin with an integer.
E.g., `(0 == 'kq3p37awi2n5')` is true in PHP 7.4 and below, this can sometimes cause multiple tabs to be displayed when a tab panel is first loaded onto a page:
{F278735}
Test Plan: Create a tab panel with at least 3 tabs, add a couple more and ensure that multiple tabs aren't loaded.
Reviewers: O1 Blessed Committers, valerio.bozzolan, Cigaryno, avivey
Reviewed By: O1 Blessed Committers, valerio.bozzolan, Cigaryno, avivey
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15146
Differential Revision: https://we.phorge.it/D25067
Summary:
`preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1.
Thus add a `phutil_nonempty_string()` check if the `$subject` parameter is a non-empty string.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
```
EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=arcpatch-D25250, ref.master=18554ea76ceb, ref.arcpatch-D25250=fade4603a799), phorge(head=diffusionEmptyBranchHistory, ref.master=e11c5486c92b, ref.diffusionEmptyBranchHistory=76f042e4b969)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#1 <#2> preg_match(string, NULL) called at [<phorge>/src/applications/diffusion/request/DiffusionGitRequest.php:6]
```
Closes T15435
Test Plan: After applying this change, try to "Clone" a Repository with no URI set shows the overlay dialog `Clone Repository - Repository has no URIs set.` as expected.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15435
Differential Revision: https://we.phorge.it/D25266
Summary:
`preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1.
Thus first check that `$subject !== null`.
```
EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=0e32dbc1ac8f), phorge(head=diffusionRepoPage, ref.master=5405134fa5db, ref.diffusionRepoPage=dbe5e3a68c41)
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#1 <#2> preg_match(string, NULL) called at [<phorge>/src/applications/herald/typeahead/HeraldRuleDatasource.php:25]
```
Closes T15422
Test Plan: Applied this change; afterwards on the "Diffusion 🡒 Push Logs 🡒 Advanced Search" page at `/diffusion/pushlog/?repositories=PHID-REPO-someRepositoryString`, clicking the search icon for the "Blocked By" field correctly renders.the "Browse Herald Rules" overlay dialog, listing available Herald rules.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15422
Differential Revision: https://we.phorge.it/D25248
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15428
Test Plan:
Applied this change; afterwards displays "Database Status" page at `/config/database/` correctly rendered in web browser.
Also visit every single database name, to see that also there nothing explode.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15428
Differential Revision: https://we.phorge.it/D25260
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15425
Test Plan: Applied this change; afterwards `/conduit/method/dashboard.panel.edit/` correctly renders in browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15425
Differential Revision: https://we.phorge.it/D25257
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15421
Test Plan:
Applied this change, create a repository, and afterwards the repository page at `/diffusion/9/` is shown with its name and "Empty Repository - This repository does not have any commits yet."
- have a Diffusion repository with Staging Area and Automation already setup
- create a Differential patch from arc
- press the Land button on the UI and write random things inside
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15421
Differential Revision: https://we.phorge.it/D25247
Summary:
Passing null as an input string to explode() is deprecated in PHP 8.
Thus first check via `phutil_nonempty_string()` that the input string is not null.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15361
Test Plan: Applied this change; afterwards `/multimeter/` correctly rendered in web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15361
Differential Revision: https://we.phorge.it/D25254
Summary:
Premising that Remarkup supports a fully-featured cowsay generator (!)... since 2015 this awesome
thing no longer requires a binary cowsay command, since everything was rewritten in the core:
c705c8011e
So, some files from the legacy cowsay version in Perl can be safely removed.
We still thank the original author Tony Monroe for the original version in Perl (dated 2000),
and Evan Priestley for the re-implementation in PHP.
Probably nobody knows about this feature. This may change in the future. See T15401.
Closes T15418
Test Plan:
Try some awesome cows to verify that everything still works. For instance:
```
cowsay {{{
hello
}}}
```
```
cowsay (think=yes,eyes=XX,tongue=^^) {{{
hello
}}}
```
```
cowsay (cow=stegosaurus) {{{
hello
}}}
```
If nothing explodes, yuppie! Cowsay still works.
Credits to the original version in Perl remained in place.
Reviewers: O1 Blessed Committers, avivey
Reviewed By: O1 Blessed Committers, avivey
Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15418
Differential Revision: https://we.phorge.it/D25242
Summary:
Removes the -khtml, -moz and -ms prefix, since most Browsers are natively supporting the user select directive.
The -webkit prefix is still kept or added for Safari, wich does not support user-select.
Ref: see https://we.phorge.it/D25024#815 for context
Test Plan: Removing the CSS should change nothing in modern browsers.
Reviewers: O1 Blessed Committers, speck, valerio.bozzolan, Matthew
Reviewed By: O1 Blessed Committers, speck, valerio.bozzolan
Subscribers: Cigaryno, Matthew, speck, tobiaswiese, valerio.bozzolan
Differential Revision: https://we.phorge.it/D25025
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1.
Interestingly, in upstream they started fixing this yesterday, with just this minimal change:
https://secure.phabricator.com/rPf6214f060e780ecf7b565c5a0edbd28d85c03275#C11580NL1139
Premising counting the length of a string just to answer the question "is this empty?" may be overkill,
but premising that adopting stuff like phutil_nonempty_string() could be too risky, we just do
an explicit cast to string, to answer the question "Is this string empty?" just like it was done
under the hood by the strlen() function.
In short, this is probably nice and more readable than upstream (but not a competition).
Closes T15370
Test Plan:
- create a Mercurial repository
- push some things
- it should conclude the import (or at least unlock a different Exception)
Reviewers: O1 Blessed Committers, speck, avivey
Reviewed By: O1 Blessed Committers, avivey
Subscribers: avivey, amit, speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15370
Differential Revision: https://we.phorge.it/D25204
Summary: Refs T15064.
Test Plan: Generated the doc locally, see that it says what I was planning for it to say.
Reviewers: valerio.bozzolan, aklapper, O1 Blessed Committers
Reviewed By: valerio.bozzolan, O1 Blessed Committers
Subscribers: speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15064
Differential Revision: https://we.phorge.it/D25245
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15420
Test Plan: Applied these two changes; afterwards "Browse Repositories" overlay dialog gets rendered in web browser and lists existing repositories.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15420
Differential Revision: https://we.phorge.it/D25244
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15419
Test Plan:
Applied this changes and page at `/w/` correctly rendered saying `Document Deleted - This document has been deleted. You can edit it to put new content here, or use history to revert to an earlier version.`
Also test creating it again, and updating it again: it still works.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15419
Differential Revision: https://we.phorge.it/D25243
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15398
Test Plan:
Applied this change and "Edit Menu Item" overlay dialog correctly shows "You must choose a project" resp. "You must choose a room." error message, now without an exception.
Go to /home/menu/configure/custom/ and also to /home/menu/configure/global/ and try:
- Add Label with name `0` / `1` / `1.123` etc.
- Add Label, Save again
- Add Link, Save again
- Add Application, Save again
- Add Divider, Save again
- Add Conpherence, Save again
- Add Link, Save Again
- Add Motivator (Cat Facts), Save again
- Add Form, Save again
- Order Items
- Activate/Disable Built-in Home (unrelated)
- Remove all the above
Also, tried on a Project menu.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15398
Differential Revision: https://we.phorge.it/D25230
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. So, we adopt an explicit cast to string
in order to answer the question "Is this a non-empty string?" without relying on implicit
cast and deprecated things.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_string_cast() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15409
Test Plan:
Applied this change and afterwards, selecting "Working Copy" on `/drydock/blueprint/edit/form/default/` does not show a RuntimeException on strlen() anymore. Instead, it shows a PhutilAggregateException covered in T15408.
Try also creating an integer "Custom Field" in some applications like Maniphest (maniphest.custom-field-definitions)
or in the People component (user.custom-field-definitions) etc., populating the related forms with your usual fuzzy tests.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15409
Differential Revision: https://we.phorge.it/D25235
Summary:
Since PHP 8.1, passing a null string to `trim()` is deprecated.
Thus first check that $row['oldValue'] is not null before trimming it.
Closes T15392
Test Plan: Applied this change; afterwards "Burnup Rate" page at `/maniphest/report/burn/` got correctly rendered in web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15392
Differential Revision: https://we.phorge.it/D25224
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Here we adopt `phutil_string_cast()` to
reply to the question "is this an empty string?".
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_string_cast() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15390
Test Plan:
Enable `maniphest.points` in settings, for example with:
```
./bin/config set maniphest.points --stdin <<< '{"enabled":true}'
```
Then try to create a Task: it does not explode anymore in PHP 8.1+.
Also try to set various possible values from the Conduit API method "maniphest.edit".
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15390
Differential Revision: https://we.phorge.it/D25222
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
Receiving null is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15389
Test Plan:
Applied these three changes; afterwards writing `{F1234}` in the Task Comment text field finally rendered the image preview in the preview area, plus I could successfully add the Comment.
Additional cute tests:
```
Test alt:
{F1234,alt=0}
{F1234,alt=null}
{F1234,alt=123}
{F1234,alt=0.1}
{F1234,alt=[]}
Test width:
{F1234,width=0}
{F1234,width=10}
{F1234,width=10.1}
{F1234,width=10%}
{F1234,width=49.99%}
{F1234,width=100%}
Test height:
{F1234,height=0}
{F1234,height=10}
{F1234,height=10.1}
{F1234,height=10%}
{F1234,height=49.99%}
{F1234,height=100%}
Test mix width/height:
{F1234,height=0,width=0}
{F1234,height=10,width=15}
{F1234,height=10.1,width=15}
{F1234,height=10%,width=15%}
{F1234,height=49.99%,width=15%}
{F1234,height=100%,width=15%}
```
If you have no nuclear implosion and if dimensions are somehow respected and the alt text works, well done! Test passed.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15389
Differential Revision: https://we.phorge.it/D25221
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15388
Test Plan:
Applied these two changes; afterwards managed to add a 2FA factor and `/settings/user/username/page/multifactor/?id=1` correctly listed mys Authentication Factors.
Additional tests:
- Unset any eventual personal MFA
- Setup a personal MFA
- Login/Logout using the MFA
- Remove a personal MFA
- Setup a personal enroll message from /auth/mfa/1/
- Setup a personal MFA
- Login/Logout using the MFA
- (then cleanup removing your test MFA)
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15388
Differential Revision: https://we.phorge.it/D25219
Summary:
Passing null to the `$string` in `explode(string $separator, string $string, int $limit)` is deprecated since PHP 8.1.
Thus do not explode but create an empty array if the input is null.
Closes T15397
Test Plan: Applied this change and afterwards the "Provide Multi-Factor Credentials" page at `/auth/finish/` showing the "App Code" field correctly rendered in the web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15397
Differential Revision: https://we.phorge.it/D25229
Summary:
Since PHP 8.1 the function call `strlen(null)` is deprecated.
Since Phabricator/Phorge elevates deprecation warnings to exceptions, the
specific fix implies dealing with null, and dealing with real strings.
In the specific case, a simple cast was made to deal with real strings.
Closes T15315
Test Plan: Visit the Home Page with DarkConsole enabled in your configuration: no crashes
Reviewers: O1 Blessed Committers, avivey
Reviewed By: O1 Blessed Committers, avivey
Subscribers: aklapper, speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15315
Differential Revision: https://we.phorge.it/D25165
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Similarly, passing `null` to the `$haystack` parameter of `strpos()` is deprecated in PHP 8.1.
Similarly, passing `null` to the `$string` parameter of `ltrim()` is deprecated in PHP 8.1.
Closes part of T15335
Test Plan: Applied these four changes in Phorge (plus the one change in D25180 in Arcanist) and the `Browse Projects` overlay dialog finally rendered in web browser and listed existing projects.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15335
Differential Revision: https://we.phorge.it/D25179
Summary:
Explicitly mentioning PHP5 packages is outdated and confusing.
Also, mentioning dnf together with yum (apparently yum is still in use!). Good for yum users.
Closes T15352
Test Plan: Applied this change and strings on the "Missing Required Extensions" page rendered as expected.
Reviewers: O1 Blessed Committers, valerio.bozzolan, jgleeson
Reviewed By: O1 Blessed Committers, valerio.bozzolan, jgleeson
Subscribers: jgleeson, bfs, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15352
Differential Revision: https://we.phorge.it/D25203
Summary:
Since PHP 8.1, passing a null string to `ltrim(string $string)` is deprecated.
Thus we make sure that `$request->getStr('email')` does not return null as default.
Closes T15376
Test Plan: Applied this change, afterwards repeated the steps to add a new email address on `/settings/panel/email/`. This time, it's possible to close the "Verification Email Sent" and the page `/settings/panel/email/` renders and lists the new email address.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15376
Differential Revision: https://we.phorge.it/D25210
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15386
Test Plan: Applied this change, afterwards page "Mobile Phone App (TOTP)" at `/auth/mfa/4/` renders in web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15386
Differential Revision: https://we.phorge.it/D25218
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15391
Test Plan:
Applied this change and afterwards, "Bulk Editor" page on `/maniphest/bulk/` rendered correctly.
To test that:
- visit a list of some Tasks (like `/maniphest/`)
- filter something (this can be done in multiple ways)
- select Tasks
- click on Bulk Edit Selected Tasks
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15391
Differential Revision: https://we.phorge.it/D25223
Summary:
This is a small fix in a specific user message example. See other messages in the very same file which also use `<tt>`.
Here the problematic phrase:
{F292970}
See the example in the phrase "Use lowercase letters, digits, and periods. For example: ...".
Test Plan: After this change, the specific message "The URI where the OAuth server is installed. For example" from the page `/auth/config/edit/?provider=PhabricatorPhabricatorAuthProvider` does not have anymore backticks shown to the end user.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Differential Revision: https://we.phorge.it/D25232
Summary:
Fix a specific problem when visiting some specific pages like this one:
/auth/config/edit/?provider=PhabricatorPhabricatorAuthProvider:
Regression introduced in:
562d36ef5f
Stack trace:
[Fri May 19 14:23:35.506028 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] [2023-05-19 14:23:35] EXCEPTION: (InvalidArgumentException) Call to phutil_nonempty_string() expected null or a string, got: PhutilSafeHTML. at [<arcanist>/src/utils/utils.php:2127]
[Fri May 19 14:23:35.506647 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] arcanist(head=arcpatch-D25049, ref.master=c14785c3795c, ref.arcpatch-D25049=1b6412c24640), phorge(head=arcpatch-D25216_1, ref.master=2df7ea13a387, ref.arcpatch-D25216_1=02b40a9e25eb)
[Fri May 19 14:23:35.506661 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] #0 <#2> phutil_nonempty_string(PhutilSafeHTML) called at [<phorge>/src/view/form/control/AphrontFormControl.php:206]
[Fri May 19 14:23:35.506665 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] #1 <#2> phutil_tag(string, array, array) called at [<phorge>/src/view/form/PHUIFormLayoutView.php:54]
[Fri May 19 14:23:35.506667 2023] [php7:notice] [pid 20439] [client 127.0.0.1:39692] #2 <#2> PHUIFormLayoutView::render() called at [<phorge>/src/view/form/AphrontFormView.php:160]
We keep 100% backward compatibility, reproducing the implicit cast happening automatically before PHP 8.1
It has also been simplified the non-empty check since that is possible after casting to string.
Closes T15404
Test Plan:
- Visit the page mentioned in the commit summary
- no longer explodes
- you still don't see empty Captions
- you still see populated Captions
- you still see HTML rendered for populated Captions
Reviewers: O1 Blessed Committers, avivey
Reviewed By: O1 Blessed Committers, avivey
Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15404
Differential Revision: https://we.phorge.it/D25231
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15383
Test Plan:
Applied these two changes; afterwards "Username/Password" page at `/auth/config/view/1/` gets rendered in web browser.
Additional tests (you need D25231 to complete this test plan):
- Create WordPress Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Twitter Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Amazon Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Asana Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Bitbucket Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Disqus Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Disqus Auth; Edit; Disable Enable (and Disable again to cleanup)
- Create Facebook Auth; Edit; Disable Enable (and Disable again to cleanup)
- Create GitHub Auth; Edit; Disable Enable (and Disable again to cleanup)
- Create JIRA Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Google Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create LDAP Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Phorge Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Slack Auth; Edit; Disable; Enable (and Disable again to cleanup)
- Create Twitch.tv Auth; Edit; Disable; Enable (and Disable again to cleanup)
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15383
Differential Revision: https://we.phorge.it/D25216
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Similarly, `preg_match()` does not accept passing `null` as `$subject` parameter since PHP 8.1.
Closes T15337
Test Plan: Applied these four changes and `/diffusion/4/manage/` finally rendered in web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15337
Differential Revision: https://we.phorge.it/D25182
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15395
Test Plan: Applied these two changes; afterwards "All Signatures" page at `/legalpad/signatures/1/` gets rendered in web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15395
Differential Revision: https://we.phorge.it/D25226
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Closes T15382
Test Plan:
Applied this change and after performing steps to send a test message again, `/mail/detail/107/` page got rendered correctly
and I can see the "Status Details" with stuff like "//None//" or "No mailers are configured."
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15382
Differential Revision: https://we.phorge.it/D25215
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.
Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.
Similarly, `explode(string $separator, string $string, int $limit)` does not accept
passing null instead of an actual string as input parameter either anymore.
Closes T15284
Test Plan: Applied these two changes. Afterwards, admin user account was created and Phorge homepage rendered in web browser on a fresh installation.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15284
Differential Revision: https://we.phorge.it/D25175
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
But, that function does not accept null anymore since PHP 8.1.
Closes T15396
Test Plan: Applied this change (on top of D25179 and D25226) and the "Browse Dashboards" dialog got rendered in web browser.
Reviewers: O1 Blessed Committers, valerio.bozzolan
Reviewed By: O1 Blessed Committers, valerio.bozzolan
Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno
Maniphest Tasks: T15396
Differential Revision: https://we.phorge.it/D25227
Summary:
Fix a regression in this specific point:
phutil_nonempty_string(integer) called at [<phorge>/src/applications/transactions/storage/PhabricatorModularTransactionType.php:342]
This regression was causing a broken Almanac page and maybe others.
Note: The function phutil_nonempty_string() is well-known to be very angry and
throws for any alien value. This is by design, and in many cases
this is appropriate. But not here.
The business logic here handles very generic types like integers
and really probably whatever scalar value coming from an user input
and then normalized to something else, not necessarily a string, but definitely
something that can be cast to string.
If you have better ideas about how to handle these cases, please join T15190.
Closes T15385
Test Plan:
To test Almanac:
1. go to `/almanac/network/` and create at least one network (example: "foo")
2. go to `/almanac/device/` and create at least one device (example: "bar")
3. visit that Device
4. Add Interface
- test the creation of an empty Interface
- test the creation of a right Interface (example: Network "foo", Address 127.0.0.1, Port 80)
- nothing esplodes anymore
Reviewers: arnold, O1 Blessed Committers, avivey
Reviewed By: arnold, O1 Blessed Committers, avivey
Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno
Maniphest Tasks: T15385
Differential Revision: https://we.phorge.it/D25220