FriendsOfFlarum / pretty-mail

A Flarum extension that allows you to make custom html templates for emails!
MIT License
8 stars 1 forks source link

Incompatibility with v1.0.2 #23

Closed zcourts closed 3 years ago

zcourts commented 3 years ago

Bug Report

Current Behavior

2021/06/16 18:32:42 [error] 27#27: *9 FastCGI sent in stderr: "PHP message: PHP Warning:  scandir(/flarum/app/vendor/fof/pretty-mail/src/../../../public/assets/): failed to open dir: No such file or directory in /flarum/app/vendor/fof/pretty-mail/src/Mailer.php on line 55PHP message: PHP Warning:  scandir(): (errno 2): No such file or directory in /flarum/app/vendor/fof/pretty-mail/src/Mailer.php on line 55PHP message: PHP Warning:  preg_grep() expects parameter 2 to be array, bool given in /flarum/app/vendor/fof/pretty-mail/src/Mailer.php on line 55" while reading response header from upstream, client: 10.2.3.11, server: , request: "POST /api/mail/test HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "...", referrer: ".../admin"

Steps to Reproduce Install version 1.0.0 of the extension with version 1.0.0 of flarum

Expected Behavior The correct PHP args to be used

Environment

Output of "php flarum info", run this in terminal in your Flarum directory.
Flarum core 1.0.2
PHP version: 7.3.27
Loaded extensions: Core, date, libxml, pcre, zlib, filter, hash, readline, Reflection, SPL, session, ctype, curl, dom, fileinfo, gd, gmp, iconv, intl, json, mbstring, openssl, PDO, standard, tokenizer, xmlwriter, zip, exif, mysqlnd, Phar, pdo_mysql, Zend OPcache
+------------------------------------------+---------+--------+
| Flarum Extensions                        |         |        |
+------------------------------------------+---------+--------+
| ID                                       | Version | Commit |
+------------------------------------------+---------+--------+
| flarum-flags                             | v1.0.0  |        |
| flarum-suspend                           | v1.0.0  |        |
| flarum-subscriptions                     | v1.0.0  |        |
| flarum-tags                              | v1.0.3  |        |
| fof-oauth                                | 1.0.1   |        |
| fof-impersonate                          | 1.0.0   |        |
| flarum-approval                          | v1.0.0  |        |
| flarumite-simple-discussion-views        | 1.0.1   |        |
| flarum-nicknames                         | v1.0.0  |        |
| fof-user-directory                       | 1.0.1   |        |
| fof-follow-tags                          | 1.0.0   |        |
| fof-nightmode                            | 1.0.0   |        |
| alexanderomara-gravatar                  | 1.5.0   |        |
| fof-formatting                           | 1.0.0   |        |
| fof-recaptcha                            | 1.0.0   |        |
| fof-user-bio                             | 1.0.0   |        |
| fof-split                                | 1.0.0   |        |
| fof-spamblock                            | 1.0.0   |        |
| fof-subscribed                           | 1.0.0   |        |
| fof-prevent-necrobumping                 | 1.0.0   |        |
| fof-sitemap                              | 1.0.0   |        |
| fof-pwned-passwords                      | 1.0.0   |        |
| fof-pretty-mail                          | 1.0.0   |        |
| fof-pages                                | 1.0.1   |        |
| fof-links                                | 1.0.0   |        |
| fof-default-user-preferences             | 1.0.0   |        |
| fof-analytics                            | 1.0.0   |        |
| fof-merge-discussions                    | 1.0.0   |        |
| fof-reactions                            | 1.0.0   |        |
| fof-polls                                | 1.0.2   |        |
| fof-github-autolink                      | 1.0.0   |        |
| zerosonesfun-elint                       | 3.4     |        |
| askvortsov-moderator-warnings            | v0.6.0  |        |
| fof-moderator-notes                      | 1.0.0   |        |
| fof-geoip                                | 1.0.0   |        |
| fof-filter                               | 1.0.0   |        |
| clarkwinkelmann-author-change            | 1.0.1   |        |
| fof-drafts                               | 1.0.0   |        |
| fof-best-answer                          | 1.0.1   |        |
| askvortsov-discussion-templates          | v0.8.0  |        |
| clarkwinkelmann-popular-discussion-badge | 1.0.0   |        |
| clarkwinkelmann-bookmarks                | 1.0.0   |        |
| ianm-synopsis                            | 1.0.0   |        |
| clarkwinkelmann-first-post-approval      | 1.0.0   |        |
| fof-ignore-users                         | 1.0.0   |        |
| fof-share-social                         | 1.0.0   |        |
| fof-socialprofile                        | 1.0.0   |        |
| fof-upload                               | 1.0.1   |        |
| fof-username-request                     | 1.0.0   |        |
| ianm-follow-users                        | 1.0.0   |        |
| sycho-profile-cover                      | v1.3.0  |        |
| askvortsov-help-tags                     | v1.1.0  |        |
| flarum-sticky                            | v1.0.0  |        |
| flarum-statistics                        | v1.0.0  |        |
| flarum-mentions                          | v1.0.0  |        |
| flarum-markdown                          | v1.0.1  |        |
| flarum-lock                              | v1.0.0  |        |
| flarum-likes                             | v1.0.0  |        |
| flarum-lang-english                      | v1.0.0  |        |
| flarum-emoji                             | v1.0.0  |        |
| flarum-bbcode                            | v1.0.0  |        |
+------------------------------------------+---------+--------+
Base URL: https://hypi.dev
Installation path: /flarum/app
Debug mode: off
dsevillamartin commented 3 years ago

This is caused by this line - https://github.com/FriendsOfFlarum/pretty-mail/blob/a03ac37d9eb5fcb7975c6a17da421c4002032e3e/src/Mailer.php#L27

I don't know why we have this hard coded instead of using the app public path...

When we fix this we should also change https://github.com/FriendsOfFlarum/pretty-mail/blob/a03ac37d9eb5fcb7975c6a17da421c4002032e3e/src/Overrides/NotificationMailer.php#L46.

dsevillamartin commented 3 years ago

My fix assumes the issue was caused by an... unusual public folder path - either way, this should solve this issue and more. Let me know if the issue persists in fof/pretty-mail@1.0.1.

zcourts commented 3 years ago

Your assumption seemed to be correct. Verified it is resolved with 1.0.1