1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-02 03:32:42 +01:00
phorge-phorge/src/applications/files
Andre Klapper 108cbcd09b Fix PHP 8.1 "base64_decode(null)" exception calling Conduit's file.upload with no data passed
Summary:
Since PHP 8.1, `base64_decode()` does not accept passing null as a parameter. Thus first check that `data !== null` before calling `decodeBase64($data)` (which then calls PHP's `base64_decode()`), and throw an exception if it is.

```
EXCEPTION: (RuntimeException) base64_decode(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=18554ea76ceb), phorge(head=conduitDashboardPanelEdit, ref.master=0d81da590923, ref.conduitDashboardPanelEdit=ab4391b30465)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> base64_decode(NULL, boolean) called at [<phorge>/src/applications/files/conduit/FileConduitAPIMethod.php:84]
```

Closes T15426

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

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15426

Differential Revision: https://we.phorge.it/D25258
2023-06-11 16:34:16 +02:00
..
action Simplify implementation of "SysetemAction->getSystemActionConstant()" 2019-07-19 15:45:37 -07:00
application Update "Files" attachment table to show more attachment details and support detachment 2022-05-25 12:56:37 -07:00
applicationpanel Allow diffusion.filecontentquery to load data for arbitrarily large files 2016-01-21 09:52:43 -08:00
builtin Fix PHP 8.1 "implicit conversion from float to int" exception on certain avatar colors which blocks rendering user pages 2023-05-12 11:58:22 +02:00
capability Add default policy to Files application 2014-11-21 11:17:20 -08:00
conduit Fix PHP 8.1 "base64_decode(null)" exception calling Conduit's file.upload with no data passed 2023-06-11 16:34:16 +02:00
config Remove product literal strings in "pht()", part 19 2022-04-25 16:46:25 -07:00
constants Prettier file embeds 2016-11-27 14:57:06 -08:00
controller Fix PHP 8.1 "strlen(null)" exceptions which block rendering page of a File 2023-05-06 04:07:03 +02:00
diff Fix two rendering issues with Jupyter notebooks 2020-05-22 11:53:55 -07:00
document Fix PHP 8.1 "strlen(null)" exceptions which block rendering page of a File 2023-05-06 04:07:03 +02:00
editor Provide default image alt text in more contexts and support custom alt text 2021-03-04 16:51:23 -08:00
engine PHP 8.2: fixes for strlen() not accepting NULL anymore, part 1 2023-03-31 22:05:52 +02:00
engineextension Provide a simple "Attach File" explicit workflow for files referenced but not attached 2022-05-24 09:49:59 -07:00
exception Store and verify content integrity checksums for files 2017-04-05 11:12:31 -07:00
favicon Recover more gracefully when favicon configuration points at a corrupt/damaged file 2018-04-27 12:02:32 -07:00
format Fix some test suite stragglers with PHP 8.1 compatibility 2022-05-19 12:04:09 -07:00
garbagecollector Implement ngram search for File objects 2017-04-17 17:37:20 -07:00
iconset Convert all calls to 'IconFont' to just 'Icon' 2016-01-27 20:59:27 -08:00
keyring Support AES256 at-rest encryption in Files 2016-06-16 08:08:56 -07:00
lipsum Make bin/lipsum generate hanldle generator keys and arguments more clearly 2017-02-27 09:09:28 -08:00
mail Remove "metamta.*.subject-prefix" options 2019-01-17 19:18:50 -08:00
management Make "bin/files" parsing of working set arguments more consistent 2019-06-24 16:02:39 -07:00
markup Fix PHP 8.1 exceptions which block adding an embedded File preview as a Comment 2023-05-23 11:55:03 +02:00
phid Provide a simple "Attach File" explicit workflow for files referenced but not attached 2022-05-24 09:49:59 -07:00
query Provide a default "loadPage()" implementation on "CursorPagedPolicyAwareQuery" 2022-05-24 10:18:53 -07:00
storage Fix PHP 8.1 "strlen(null)" exceptions which block rendering page of a File 2023-05-06 04:07:03 +02:00
transform Add unit tests for file thumbnail generation 2017-04-23 11:02:21 -07:00
typeahead Add a basic icon typeahead 2017-02-03 09:19:29 -08:00
uploadsource Support export of data in files larger than 8MB 2018-01-29 15:58:34 -08:00
view Fix numerous PHP 8.1 "strlen(null)" exceptions preventing homepage to display 2023-04-27 14:08:48 +02:00
worker Make daemons perform file deletion 2017-04-18 11:09:41 -07:00
xaction Fix PHP 8.1 "strlen(null)" exception which blocks rendering a File page when Alt Text was altered 2023-05-06 04:08:20 +02:00
PhabricatorImageTransformer.php Somewhat improve meme transform code so it is merely very bad 2018-03-08 11:08:55 -08:00