Events Made Easy › Forums › Bug fixed or feature request implemented › Error managing discounts
- This topic has 10 replies, 2 voices, and was last updated 1 year, 9 months ago by Franky.
-
AuthorPosts
-
Wed 14 Dec 2022 at 12:18 #64810AnonymousInactive
Hi Franky,
There appears to be a bug in the Discount system: when I go to Discounts -> Manage discounts I get an error message ‘An error occured while communicating to the server’.
Also I get an empty Discounts list, even though I have two discount codes active.When I discard the error message I can still add new discounts and they can be selected in the RSVP section of the events, but the list remains empty. This makes it impossible to edit them or add them to a discount group.
Hope you can resolve this.
Wed 14 Dec 2022 at 13:57 #64811FrankyKeymasterJust checked here: list works fine. So something is probably interfering here. Did you check your browser console for javascript errors? Or what is being returned by the server (in the browser console, tab “network” when showing the list discounts)?
Probably some plugin (or your theme) is adding extra text to the returned info, causing issues.Wed 14 Dec 2022 at 14:28 #64812AnonymousInactiveThanks for your quick response.
I just checked, deactivated all other plugins and switched to Twenty Twenty theme, but the error still occurs.
I see this error in console:
POST [path]/wp-admin/admin-ajax.php?action=eme_discounts_list&jtStartIndex=0&jtPageSize=50&jtSorting=name%20ASC 500
followed by a list of filesUnder Network there’s a red line reading:
Request URL: [path]/wp-admin/admin-ajax.php?action=eme_discounts_list&jtStartIndex=0&jtPageSize=50&jtSorting=name%20ASCHope this helps clear things up.
Wed 14 Dec 2022 at 14:57 #64813FrankyKeymasterA red line? And what causes the red line? I’m assuming it means the request got blocked so what’s causing that?
Wed 14 Dec 2022 at 16:59 #64814AnonymousInactiveI’m sorry, I’m not a programmer so not sure what to look for. It says ‘Status Code: 500’ which I think indicates a server error.
But I may have another lead: I recently upgraded my site to PHP8, and after reverting to PHP7.4 the problem went away! All discounts are listed again.
So it appears to be a PHP problem, could that be it?Wed 14 Dec 2022 at 17:34 #64815FrankyKeymasterI indeed tested on a server with 7.4 today. I’ll test locally on php 8.1
Wed 14 Dec 2022 at 17:50 #64816FrankyKeymasterJust tested with php 8.1: no issues here.
So I assume another plugin is triggering an issue. When you get the code 500 (which indeed refers to a php error probably), what is in the server php error logfile?Wed 14 Dec 2022 at 18:29 #64817AnonymousInactiveThanks again, I have already tested with all other plugins deactivated and switching to default theme, so I think we can rule that out.
Again I’m not sure what to look for so I’ll just paste the last entries in the php error log. Hope this is of any help:[Wed Dec 14 16:39:08.437714 2022] [lsapi:warn] [pid 3647817:tid 140556646717184] [client 100.26.127.17:46819] [host xxx.xx] Backend log: PHP Warning: Trying to access array offset on value of type bool in [path]/public_html/wp-content/themes/tt-theater/header.php on line 28\n [Wed Dec 14 16:51:30.227578 2022] [lsapi:warn] [pid 3707854:tid 140557158344448] [client 87.210.12.255:52680] [host xxx.xx] Backend log: PHP Warning: Undefined variable $res_arr in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 16:51:30.228010 2022] [lsapi:error] [pid 3707854:tid 140557158344448] [client 87.210.12.255:52680] [host xxx.xx] Backend fatal error: PHP Fatal error: Uncaught TypeError: join(): Argument #1 ($pieces) must be of type array, string given in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php:1524\nStack trace:\n#0 [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php(1524): join()\n#1 [path]/public_html/wp-includes/class-wp-hook.php(308): eme_ajax_discounts_list()\n#2 [path]/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()\n#3 [path]/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#4 [path]/public_html/wp-admin/admin-ajax.php(188): do_action()\n#5 {main}\n thrown in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 16:56:35.584362 2022] [lsapi:warn] [pid 4020993:tid 140557107988224] [client 87.210.12.255:53902] [host xxx.xx] Backend log: PHP Warning: join(): Invalid arguments passed in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 16:56:35.584799 2022] [lsapi:warn] [pid 4020993:tid 140557107988224] [client 87.210.12.255:53902] [host xxx.xx] Backend log: PHP Warning: join(): Invalid arguments passed in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 16:57:04.644830 2022] [lsapi:warn] [pid 3881808:tid 140557141559040] [client 87.210.12.255:54063] [host xxx.xx] Backend log: PHP Warning: Undefined variable $res_arr in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 16:57:04.644949 2022] [lsapi:error] [pid 3881808:tid 140557141559040] [client 87.210.12.255:54063] [host xxx.xx] Backend fatal error: PHP Fatal error: Uncaught TypeError: join(): Argument #1 ($pieces) must be of type array, string given in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php:1524\nStack trace:\n#0 [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php(1524): join()\n#1 [path]/public_html/wp-includes/class-wp-hook.php(308): eme_ajax_discounts_list()\n#2 [path]/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()\n#3 [path]/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#4 [path]/public_html/wp-admin/admin-ajax.php(188): do_action()\n#5 {main}\n thrown in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 17:03:29.766504 2022] [lsapi:warn] [pid 4049956:tid 140557292627712] [client 87.210.12.255:55604] [host xxx.xx] Backend log: PHP Warning: join(): Invalid arguments passed in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts [Wed Dec 14 17:03:29.766955 2022] [lsapi:warn] [pid 4049956:tid 140557292627712] [client 87.210.12.255:55604] [host xxx.xx] Backend log: PHP Warning: join(): Invalid arguments passed in [path]/public_html/wp-content/plugins/events-made-easy/eme_discounts.php on line 1524\n, referer: [URL]/wp-admin/admin.php?page=eme-discounts&eme_admin_action=discounts
Wed 14 Dec 2022 at 19:00 #64818FrankyKeymasterok, that’s indeed a bug in EME (when using “older” discounts in fact, where the discount groups were by name and not by id). And apparently php 8 is stricter when trying to join an not-defined array 🙂
This should fix it:
https://plugins.trac.wordpress.org/changeset/2833968/Wed 14 Dec 2022 at 20:02 #64819AnonymousInactiveYou did it again: a quick and smooth solution!
Indeed there was an old discount in the list, and now they all show up nicely.😁
Many many thanks!Wed 14 Dec 2022 at 21:37 #64820FrankyKeymastertx, I’ll release a new version with the fix (probably the last of this year 🙂 )
-
AuthorPosts
- The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.