Skip to content

Commit 72b88ba

Browse files
Merge pull request #115 from closemarketing/114-fatal-error-create_entry-on-null-contactform7php
Prevent fatal errors
2 parents 28c2345 + d4cea0c commit 72b88ba

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

formscrm.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
/**
33
* Plugin Name: FormsCRM
4-
* Plugin URI : https : //close.technology/wordpress-plugins/formscrm/
4+
* Plugin URI : https://close.technology/wordpress-plugins/formscrm/
55
* Description: Connects Forms with CRM, ERP and Email Marketing.
6-
* Version : 4.0.5
7-
* Author : CloseTechnology
8-
* Author URI : https : //close.technology
6+
* Version: 4.0.5
7+
* Author: CloseTechnology
8+
* Author URI: https://close.technology
99
* Text Domain: formscrm
1010
* Domain Path: /languages
11-
* License : GPL-2.0+
12-
* License URI: http : //www.gnu.org/licenses/gpl-2.0.txt
11+
* License: GPL-2.0+
12+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
1313
*
1414
* @package WordPress
1515
* @author CloseTechnology

includes/formscrm-library/class-contactform7.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ public function crm_process_entry( $contact_form ) {
290290

291291
// Create contact in CRM.
292292
$this->include_library( $crm_type );
293+
if ( empty( $this->crmlib ) ) {
294+
return;
295+
}
293296
$merge_vars = $this->get_merge_vars( $cf7_crm, $submission->get_posted_data() );
294297
$response_result = $this->crmlib->create_entry( $cf7_crm, $merge_vars );
295298

@@ -309,6 +312,9 @@ public function crm_process_entry( $contact_form ) {
309312
* @return array
310313
*/
311314
public function get_merge_vars( $cf7_crm, $submitted_data ) {
315+
if ( empty( $cf7_crm ) || ! is_array( $cf7_crm ) ) {
316+
return array();
317+
}
312318
$merge_vars = array();
313319
foreach ( $cf7_crm as $key => $value ) {
314320
if ( false === strpos( $key, 'fc_crm_field' ) ) {

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ WordPress installation and then activate the Plugin from Plugins page.
9191
= 4.0.5 =
9292
* Fixed: CF7 custom fields with select fields not sending.
9393
* Added: Expert Mode.
94+
* Fixed: Fatal errors in CF7.
9495

9596
= 4.0.4 =
9697
* Added: Webhook to send form data received from CRM in GravityForms.

0 commit comments

Comments
 (0)