1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-13 09:06:14 +01:00
phorge-phorge/scripts
Andre Klapper c589529155 Fix parsing of incoming mail with UTF-8 encoded headers
Summary:
rPa76444a8e238f647dc96f756e6c88aa2fafcdbfe updated our 13 year old copy of the mimemailparser library.
That included a behaviour change in the library not covered by Phorge code: The library now decodes MIME encoded UTF8 data in headers. Phorge passes that header to the `iconv_mime_decode()` PHP function which does not accept already encoded content.

```
EXCEPTION: (RuntimeException) iconv_mime_decode(): Detected an illegal character in input string at [<arcanist>/src/error/PhutilErrorHandler.php:273]
arcanist(head=master, ref.master=29ca3df1122b), phorge(head=master, ref.master=6ec5c88bee24)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer)
  #1 iconv_mime_decode(string, integer, string) called at [<arcanist>/src/utils/utils.php:1759]
  #2 phutil_decode_mime_header(string) called at [<phorge>/scripts/mail/mail_handler.php:64]
```

Closes T15960

Test Plan: * Have an email file called `tmp.mbox` with a UTF-8 encoded `From:` header. In `scripts/mail/mail_handler.php`, replace `file_get_contents('php://stdin')` with `file_get_contents('./tmp.mbox')`. Insert `echo $headers['subject']; echo "\n"; echo $headers['from'];` statements for debugging. Run `php ./mail_handler.php`.

Reviewers: O1 Blessed Committers, taavi, valerio.bozzolan

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

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

Maniphest Tasks: T15960

Differential Revision: https://we.phorge.it/D25839
2024-12-03 13:39:15 +01:00
..
almanac Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
cache Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
celerity Teach ./bin/celerity about sprite maps 2023-06-03 09:57:05 -07:00
daemon Merge a small amount of remaining "libphutil/" code with Phabricator, break libphutil dependency 2020-02-12 15:17:36 -08:00
diviner Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
drydock When bin/drydock lease is interrupted, release leases 2018-02-13 13:14:21 -08:00
fact Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
files Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
init Change some instances of "phabricator" to "phorge" 2023-11-18 22:14:15 +00:00
install Merge Phacility/master into phorge 2022-07-25 11:50:26 -07:00
lipsum Improve bin/lipsum UX 2015-12-24 09:06:35 -08:00
mail Fix parsing of incoming mail with UTF-8 encoded headers 2024-12-03 13:39:15 +01:00
repository Fix InvalidArgumentException on commit hook 2023-04-14 22:09:23 +02:00
search Use PhutilClassMapQuery instead of PhutilSymbolLoader 2015-08-14 07:49:01 +10:00
setup Remove "bin/celerity" dependency on database setup 2021-11-19 10:11:06 -08:00
sql Remove product literal strings in "pht()", part 1 2022-04-25 12:22:25 -07:00
ssh PHP 8.1: fixes for strlen() not accepting NULL anymore, part 2 2023-04-01 15:20:13 +02:00
symbols PHP 8.1: fixes for strlen() not accepting NULL anymore, part 2 2023-04-01 15:20:13 +02:00
util phtize all the things 2015-05-22 21:16:39 +10:00
__init_script__.php Continue on bad database configuration from select scripts 2016-09-06 14:20:57 -07:00
manage_bulk.php Allow bulk edits to be made silently if you have CLI access 2018-01-19 13:24:54 -08:00