PHP7 compatibility

Created on 27 March 2023, almost 2 years ago

Problem/Motivation

phpcs reports:

FILE: sites/all/modules/contrib/webform_bonus/modules/webform_digest/webform_digest.inc
--------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------
 351 | ERROR | Function split() is deprecated since PHP 5.3 and removed since PHP 7.0; Use preg_split() instead
 353 | ERROR | Function split() is deprecated since PHP 5.3 and removed since PHP 7.0; Use preg_split() instead
--------------------------------

Proposed resolution

diff --git a/modules/webform_digest/webform_digest.inc b/modules/webform_digest/webform_digest.inc
index ea97f1981..ff532662e 100644
--- a/modules/webform_digest/webform_digest.inc
+++ b/modules/webform_digest/webform_digest.inc
@@ -348,9 +348,9 @@ function _webform_digest_send_digest_email($emails, &$emails_conf, $key,  $downl
 
   // Parse headers.
   $headers = array();
-  $headers_arr_str = split("[\n;]", drupal_get_headers());
+  $headers_arr_str = preg_split('/[\n;]/', drupal_get_headers());
   foreach ($headers_arr_str as $header_str) {
-    $header = split("[=:]", $header_str);
+    $header = preg_split('/[=:]/', $header_str);
     $headers[trim($header[0])] = trim($header[1]);
   }
🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇳🇿New Zealand jweowu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024