Title: Fatal error after clicking submit button
Last modified: August 21, 2016

---

# Fatal error after clicking submit button

 *  Resolved [le roux](https://wordpress.org/support/users/le-roux/)
 * (@le-roux)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/)
 * I am getting this error when I click submit and confirm button
 * Fatal error: Call to a member function cancel() on a non-object in /public_html/
   www.mysite.com/wp-content/plugins/paid-memberships-pro/preheaders/checkout.php
   on line 981
 * The user is created successfully in my wordpress database but I get that error
   message on my webpage
 * [http://wordpress.org/extend/plugins/paid-memberships-pro/](http://wordpress.org/extend/plugins/paid-memberships-pro/)

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [PMPro-Lisa](https://wordpress.org/support/users/pmpro-lisa/)
 * (@pmpro-lisa)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898223)
 * Hi LeRoux – Please update:
 * [http://wordpress.org/support/topic/please-upgrade-to-1702-critical-db-fix](http://wordpress.org/support/topic/please-upgrade-to-1702-critical-db-fix)
 *  Thread Starter [le roux](https://wordpress.org/support/users/le-roux/)
 * (@le-roux)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898278)
 * Hi. I upgraded to version 1.7.0.3. but I still have the same problem.
 *  [leadingtowin](https://wordpress.org/support/users/leadingtowin/)
 * (@leadingtowin)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898279)
 * Hi
 * I have the same problem.
 * Tried different versions of the plugin and the suggested fixes
 * Please advise
 * Hitesh
 *  Plugin Author [Jason Coleman](https://wordpress.org/support/users/strangerstudios/)
 * (@strangerstudios)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898300)
 * Try 1.7.0.4, which is going out now.
 *  [PMPro-Lisa](https://wordpress.org/support/users/pmpro-lisa/)
 * (@pmpro-lisa)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898358)
 * Just checking back [@le](https://wordpress.org/support/users/le/) roux [@leadingtowin](https://wordpress.org/support/users/leadingtowin/)
   to see if the update resolved this for you.
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898362)
 * Hello – I have the same problem with the last several versions. It only applies
   to a free signup. Any solution for this bug? I am on 1.7.0.4 now by the way.
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898363)
 * I cleared the fatal error by changing line 981 of preheaters/checkout.php to 
   this:
 * if(isset($morder) && $morder->cancel())
 * which allows the following error to be displayed:
 * “IMPORTANT: Something went wrong during membership creation. Your credit card
   was charged, but we couldn’t assign your membership. You should not submit this
   form again. Please contact the site owner to fix this issue.”
 * Which of course makes no sense because the issue is only exposed on a free signup.
   There’s clearly some problem with the logic in processing a free order, I suspect
   somewhere where pmpro_isLevelFree() is called.
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898364)
 * I have isolated the probplem to a mySQL error associated with this code starting
   around line 565 of functions.php:
 *     ```
       $sql = "INSERT INTO $wpdb->pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate)
       						VALUES('" . $level['user_id'] . "',
       						'" . $level['membership_id'] . "',
       						'" . intval($level['code_id']) . "',
       						'" . $level['initial_payment'] . "',
       						'" . $level['billing_amount'] . "',
       						'" . $level['cycle_number'] . "',
       						'" . $level['cycle_period'] . "',
       						'" . $level['billing_limit'] . "',
       						'" . $level['trial_amount'] . "',
       						'" . $level['trial_limit'] . "',
       						" . $level['startdate'] . ",
       						" . $level['enddate'] . ")";
   
       				if(!$wpdb->query($sql))
       				{
       					$pmpro_error = __("Error interacting with database", "pmpro") . ": ".(mysql_errno()?mysql_error():'unavailable');
       					return false;
       				}
       ```
   
 * I have not yet been able to figure it out but perhaps it is a malformed SQL statement?
   Here it as final output:
 * `INSERT INTO wp_pmpro_memberships_users (user_id, membership_id, code_id, initial_payment,
   billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit,
   startdate, enddate) VALUES('1', '1', '0', '0.00', '0.00', '0', '', '0', '0.00','
   0', NOW(), NULL)`
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898365)
 * Ok I’m getting somewhere: I turned on error reporting and here’s what i got back:
 *     ```
       WordPress database error: [Data truncated for column 'cycle_period' at row 1]
       INSERT INTO wp_pmpro_memberships_users (user_id, membership_id, code_id, initial_payment, billing_amount, cycle_number, cycle_period, billing_limit, trial_amount, trial_limit, startdate, enddate) VALUES('1', '1', '0', '0.00', '0.00', '0', '', '0', '0.00', '0', NOW(), NULL)
       ```
   
 * As it turns out, my instance of mySQL server is in Strict mode as explained [here](http://stackoverflow.com/questions/1704304/what-is-this-error-database-query-failed-data-truncated-for-column-column-na)
   and expects the insertion of data for the cycle_period to be an enum value. Although
   there is a default value for this field set in the table of “Month”, when it 
   receives an empty value it throws the error. A quick work around for me was to
   add “INSERT IGNORE INTO” to the above SQL statement but that seems to be an invitation
   for some other problems. Perhaps some code needs to be added to force feed an
   enum value for cycle_period even if it does not apply? This might make the plugin
   more tolerant of a STRICT MODE mySQL environment. Also, I suggest the addition
   of $wpdb->show_errors(); somewhere in the script.
 *  [inator](https://wordpress.org/support/users/inator/)
 * (@inator)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898366)
 * Ok … I just couldn’t leave this one alone! Here’s a possible permanent solution.
   Just add this line directly above “$sql = “INSERT INTO $wpdb->pmpro_memberships_us…”
   around line 565 of functions.php:
 * `if ($level['cycle_period'] == '') $level['cycle_period'] = 0;`
 * Per the mySQL reference manual [here](http://dev.mysql.com/doc/refman/5.0/en/enum.html)
   an index number of 0 can be passed on the insert, which will be allowed in a 
   STRICT MODE setup without throwing an error. An examination of the resulting 
   inserted row reveals an empty value for cycle_period, I believe as intended on
   a free level, right?.
 * PMPRO developers, please let me know your thoughts. Thanks much.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Fatal error after clicking submit button’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/paid-memberships-pro_f1dacb.svg)
 * [Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions](https://wordpress.org/plugins/paid-memberships-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/paid-memberships-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/paid-memberships-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/paid-memberships-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/paid-memberships-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/paid-memberships-pro/reviews/)

 * 10 replies
 * 5 participants
 * Last reply from: [inator](https://wordpress.org/support/users/inator/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-after-clicking-submit-button/#post-3898366)
 * Status: resolved