New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent error when importing JSON settings file #3907
Comments
We tested a JSON settings import in WP 4.9.8 and it works. We confirmed the error is caused by the MIME type bug introduced in WP core 4.9.9/5.0.1. The core team is working on this issue and is planned for core 5.0.3. There is a gist available in this ticket but we need to confirm if it solves this JSON issue and possibly the related CSV issue: |
Sounds good. I'm updating the customer |
Closing as WordPress core issue to be fixed in 5.0.3 with existing workaround. |
Reopening as WP appears to not have resolve the issue for the JSON file type. We've had multiple reports of this including here: https://wordpress.org/support/topic/import-json-fails/ |
Here's a relevant Trac comment mentioning the I recommend we also follow the example in this test where the filter is added and then immediately removed after Give is done with it so that it does not enable JSON uploads universally throughout the site, but instead only where needed for importing settings. /**
* @ticket 45615
* @dataProvider _wp_check_filetype_and_ext_unsupported
*/
function test_wp_check_filetype_and_ext_unsupported_filtered( $file, $filename, $expected ) {
// With a filter these should succeed
$ext = $expected['ext'];
$mime_type = $expected['type'];
$filter = function( $mimes ) use ( $ext, $mime_type ) {
$mimes[ $ext ] = $mime_type;
return $mimes;
};
add_filter( 'upload_mimes', $filter );
$this->assertEquals( $expected, wp_check_filetype_and_ext( $file, $filename ) );
remove_filter( 'upload_mimes', $filter );
} |
I get nervous about removing the filter in the same function. If their JSON file is large will it timeout or the filter get removed before it's uploaded properly. I think it's safer to just enable the filter on the Give admin screens. |
* release/2.4.1: (35 commits) refactor: remove old donation form exporter code chore: removed unnecessary code causing PHP warning and function cleanup fix: resolved make user actual logged out when click log out link chore: add method description fix: allow json uploads for settings import screen only on WP 5.0+ #3907 fix: resolved php notice when donor address update chore: comment out PHPUnit testing code #3794 chore: update plugin version to 2.4.1 chore: add PHP 7.2 + 7.3 to travis tests fix: resolved log count is not correct when search for API log related to specific WP User fix: improve logic for cc field server side validations fix: company_name and name tag description changed as per requested fix: prevent error when exporting CSV between two dates fix: email tag description changed as per suggestion fix: allowed admin to update blank value for address input fix: improve conditional logic to work for stripe checkout as well fix: snippet added for make compatible X theme and Cornerstone plugin fix: add support for empty validation check to cc fields fix: php ruleset added for check give text domain chore: run npm update and test tasks to ensure compatibility ...
* release/2.4.1: (39 commits) refactor: remove old donation form exporter code chore: removed unnecessary code causing PHP warning and function cleanup fix: resolved make user actual logged out when click log out link chore: add method description fix: allow json uploads for settings import screen only on WP 5.0+ #3907 fix: resolved php notice when donor address update chore: comment out PHPUnit testing code #3794 chore: update plugin version to 2.4.1 chore: add PHP 7.2 + 7.3 to travis tests fix: resolved log count is not correct when search for API log related to specific WP User fix: improve logic for cc field server side validations fix: company_name and name tag description changed as per requested fix: prevent error when exporting CSV between two dates fix: email tag description changed as per suggestion fix: allowed admin to update blank value for address input fix: improve conditional logic to work for stripe checkout as well fix: snippet added for make compatible X theme and Cornerstone plugin fix: add support for empty validation check to cc fields fix: php ruleset added for check give text domain chore: run npm update and test tasks to ensure compatibility ...
* release/2.4.1: (25 commits) fix: covert microtime to string chore: fix typo fix: param typo Revert "fix: ensure donor mailing addresses match when exporting to csv" fix: resolved donor export not correct when export donor. refactor: remove old donation form exporter code chore: removed unnecessary code causing PHP warning and function cleanup fix: resolved make user actual logged out when click log out link chore: add method description fix: allow json uploads for settings import screen only on WP 5.0+ #3907 fix: resolved php notice when donor address update chore: comment out PHPUnit testing code #3794 chore: update plugin version to 2.4.1 chore: add PHP 7.2 + 7.3 to travis tests fix: resolved log count is not correct when search for API log related to specific WP User fix: improve logic for cc field server side validations fix: company_name and name tag description changed as per requested fix: prevent error when exporting CSV between two dates fix: email tag description changed as per suggestion fix: allowed admin to update blank value for address input ...
Bug Report
User Story
As a site admin, I want to import the JSON settings file from another installation so that I can quickly get Give set up in another site.
Current Behavior
When importing the JSON file from another site, I receive an error stating that the file is invalid.
Expected Behavior
I expect to import the file without receiving an error message.
Bug Type
Steps to Reproduce
Visuals
Possible Solution
Related
https://secure.helpscout.net/conversation/734568449/31321
Acceptance Criteria
Environment
Operating System
Browser
WordPress System Info
### WordPress Environment ###Home URL: http://destroy.local
Site URL: http://destroy.local
WP Version: 4.9.9
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en
Permalink Structure: /%postname%/
Show on Front: page
Page on Front: Home – Movement For A Peoples Party (#9)
Page for Posts: Blog (#84)
Table Prefix Length: wp_
Table Prefix Length: 3
Table Prefix Status: Acceptable
Admin AJAX: Accessible
Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval
Server Environment
Hosting Provider: DBH: localhost, SRV: destroy.local
TLS Connection: Connection uses TLS 1.2
TLS Connection: Probably Okay
Server Info: Apache/2.4.10 (Debian)
PHP Version: 7.0.3
PHP Post Max Size: 1,000 MB
PHP Time Limit: 900
PHP Max Input Vars: 3000
PHP Max Upload Size: 1,000 MB
cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40.
SUHOSIN Installed: –
MySQL Version: 5.6.34
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
gzip: ✔
GD Graphics Library: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
Give Configuration
Give Version: 2.3.1
Give Cache: Enabled
Database Updates: All DB Updates Completed.
Give Cache: Enabled
Give Cache: ✔New Donation✔Donation Receipt❌New Offline Donation❌Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access
Upgraded From: 2.3.0
Test Mode: Disabled
Currency Code: USD
Currency Position: Before
Decimal Separator: .
Thousands Separator: ,
Success Page: http://destroy.local/donation-confirmation/
Failure Page: http://destroy.local/donation-failed/
Donation History Page: http://destroy.local/donation-history/
Give Forms Slug: /donations/
Enabled Payment Gateways: PayPal Standard
Default Payment Gateway: PayPal Standard
PayPal IPN Verification: Enabled
PayPal IPN Notifications: IPN received for #8597 ( N/A ) on 11/21/2018 at 11:25. Status VERIFIED
Donor Email Access: Enabled
Active Give Add-ons
Give - Form Field Manager: ❌ Unlicensed – by GiveWP – 1.4.1
Other Active Plugins
Inactive Plugins
Theme
Name: bb-theme-child
Version:
Author URL:
Child Theme: Yes
Parent Theme Name: bb-theme-child
Parent Theme Version:
Parent Theme Author URL:
The text was updated successfully, but these errors were encountered: