gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
184 stars 135 forks source link

`LLMS_Admin_Import->upload_import()` expects `LLMS_Generator->set_generator()` to return WP_Error. #959

Closed pondermatic closed 5 years ago

pondermatic commented 5 years ago

Reproduction Steps

  1. Upload lifterlms/tests/assets/import-fake-generator.json to the LifterLMS Importer page at /wp-admin/admin.php?page=llms-import.
  2. LLMS_Admin_Import->upload_import() is called.
  3. LLMS_Generator->set_generator() is called and the returned value is checked for a WordPress error.

Expected Behavior

is_wp_error( $generator->set_generator() ) should return true.

Actual Behavior

is_wp_error( $generator->set_generator() ) returns false.

Later, $generator->is_error() handles the error.

Options

  1. Change is_wp_error( $generator->set_generator() ) to $generator->is_error().
  2. Change LLMS_Generator->set_generator() and all other methods in LLMS_Generator, to return a WP_Error object after adding the error code and message to it.

Error Messages / Logs

None.

System Information

System Report ``` Wordpress ------------------------------------------- Home Url: https://example.com Site Url: https://example.com Login Url: https://example.com/dashboard/ Version: 5.2.3-src Debug Mode: Yes Debug Log: No Debug Display: Yes Locale: en_US Multisite: No Page For Posts:(#1021) [https://example.com/series/] Page On Front:(#1019) [https://example.com/] Permalink Structure: /%year%/%monthnum%/%day%/%postname%/ Show On Front: page Wp Cron: Yes Settings ------------------------------------------- Version: 3.36.2 Db Version: 3.36.2 Course Catalog: Course Catalog (#561) [https://example.com/courses/] Membership Catalog: Not Set Student Dashboard: Dashboard (#564) [https://example.com/dashboard/] Checkout Page: Purchase (#563) [https://example.com/purchase/] Course Catalog Per Page: 8 Course Catalog Sorting: menu_order,ASC Membership Catalog Per Page: 9 Membership Catalog Sorting: menu_order,ASC Site Membership: Not Set Courses Endpoint: my-courses Edit Endpoint: edit-account Lost Password Endpoint: lost-password Vouchers Endpoint: redeem-voucher Autogenerate Username: yes Password Strength Meter: yes Minimum Password Strength: medium Terms Required: no Terms Page: Not Set Checkout Names: required Checkout Address: required Checkout Phone: optional Checkout Email Confirmation: yes Open Registration: yes Registration Names: required Registration Address: hidden Registration Phone: hidden Registration Voucher: required Registration Email Confirmation: no Account Names: required Account Address: hidden Account Phone: hidden Account Email Confirmation: no Confirmation Endpoint: confirm-payment Force Ssl Checkout: no Country: US Currency: USD Currency Position: left Thousand Separator: , Decimal Separator: . Decimals: 2 Trim Zero Decimals: no Recurring Payments: no Email From Address: Email From Name: Email Footer Text: Email Header Image: Cert Bg Width: 800 Cert Bg Height: 616 Cert Legacy Compat: no Gateways ------------------------------------------- Manual: Enabled Manual Logging: Manual Order: 1 Server ------------------------------------------- Mysql Version: 5.5.5 Php Curl: Yes Php Default Timezone: UTC Php Fsockopen: Yes Php Max Input Vars: 1000 Php Max Upload Size: 202 MB Php Memory Limit: 328M Php Post Max Size: 208M Php Soap: Yes Php Suhosin: No Php Time Limt: 30 Php Version: 7.2.23 Software: Apache/2.4.33 (Win64) OpenSSL/1.1.0h mod_fcgid/2.3.9 Wp Memory Limit: 40M Browser ------------------------------------------- HTTP USER AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36 Theme ------------------------------------------- Name: Version: Themeuri: Authoruri: Template: Child Theme: No Llms Support: No Plugins ------------------------------------------- Advanced Cron Manager: 2.3.9 Astra Pro: 2.0.0 Classic Editor: 1.5 Course Date Notifier: 1.0.0 Experience Visualizer: 1.0.0 Force Login: 5.3 Gutenberg: 6.5.0 H5P: 1.14.1 H5P xAPI: 0.1.7 JWT Authentication for WP-API: 1.2.6 Kanban Boards for WordPress: 2.5.12 LifterLMS: 3.36.2 LifterLMS Configurator: 1.0.0 LifterLMS REST API: 1.0.0-beta.7 OpenID Connect Generic: 3.5.0 Query Monitor: 3.4.0 User Role Editor: 4.52 User Switching: 1.5.2 vLearning: 1.0 WooCommerce Blocks: 2.4.2 WooCommerce Memberships: 1.13.0 WordPress Persistent Login: 1.3.6 Integrations ------------------------------------------- BbPress: No BuddyPress: No ```

Browser, Device, and Operating System Information

thomasplevy commented 5 years ago

Closed by pull #960 & commit https://github.com/gocodebox/lifterlms/commit/f497106cc5a8437e303e1fb57a908e6da129f503