Contact image is broken
I have reproduced on WP at https://demo.tadpole.cc/ and my install versions 5.26.2. It works on Drupal.
Reproduce:
- Go to a contact summary screen > edit > upload contact image.
- You'll see the contact image is broken.
- If you try and navigate to the link (open in new window) it gives the WP error screen.
Link looks like: https://example.org/civicrm/?page=CiviCRM&q=civicrm%2Ffile&reset=1&filename=andy_2018_150x150_20b7648df6da2e1b694b25e5398ee2c7.jpg&mime-type=image/jpeg
Clean URL's are enabled. Note it is using ?page=CiviCRM not ?page=civiwp. The image is being loaded in the /wp-content/uploads/civicrm/custom directory. Images still show on a public profile directory.
WP error log is:
Warning: file_get_contents(/wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/node_modules/mime-db/db.json): failed to open stream: No such file or directory in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php on line 36
Warning: array_values() expects parameter 1 to be array, null given in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php on line 49
Warning: array_map(): Argument #2 should be an array in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php on line 49
Warning: array_keys() expects parameter 1 to be array, null given in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php on line 52
Warning: array_combine() expects parameter 1 to be array, null given in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php on line 52
Fatal error: Uncaught TypeError: Argument 1 passed to MimeTyper\Repository\AbstractRepository::setFromMap() must be of the type array, null given, called in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php on line 52 and defined in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/AbstractRepository.php:18 Stack trace: #0 /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/MimeDbRepository.php(52): MimeTyper\Repository\AbstractRepository->setFromMap(NULL) #1 /wp-content/plugins/civicrm/civicrm/vendor/dflydev/apache-mime-types/src/Dflydev/ApacheMimeTypes/AbstractRepository.php(31): MimeTyper\Repository\MimeDbRepository->internalInit() #2 /wp-content/plugins/civicrm/civicrm/vendor/dflydev/apache-mime-types/src/Dflydev/ApacheMimeTypes/AbstractRepository.php(68): Dflydev\ApacheMimeTypes\AbstractRepository->init() #3 /wp-content/plug in /wp-content/plugins/civicrm/civicrm/vendor/adrienrn/php-mimetyper/src/Repository/AbstractRepository.php on line 18
Edited by andyburns