"Email Forms" extension is not compatible with the latest Wordpress PHP update

Hi, I want to update my website (supersleeper.co) to PHP 7.4, and run a PHP compatibility scan with a plugin called " PHP Compatibility Checker".

The scan result indicates three warnings, which all revolving around create_function() being deprecated, and suggesting the use an anonymous function instead.

I have no skills in PHP. Please advise what to do?

FYI, the scan result

FILE: /home4/waljns0afjfy/public_html/wp-content/plugins/tco-email-forms/email-integration/functions/framework/setup.php

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

28 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead

FILE: /home4/waljns0afjfy/public_html/wp-content/plugins/tco-email-forms/email-integration/functions/custom-fields-metabox.php

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

29 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead

FILE: /home4/waljns0afjfy/public_html/wp-content/plugins/tco-email-forms/email-mailchimp/functions/metabox.php

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

39 | WARNING | Function create_function() is deprecated since PHP 7.2; Use an anonymous function instead

Hey @Joyce82,

Based on the generated message, it doesn’t mean that the Email Forms plugin is not compatible with PHP 7.4. It’s still a warning which means the PHP people warn the developers to update the code as soon as possible which I believe our development is doing. But to be sure, I’ll post this in our issue tracker so this will be queued for investigation by our development team.

We could only declare if a plugin is incompatible with a certain PHP version if a function breaks producing an Error.

image

It’s also recommended to hide the warnings in your live site for security purposes. You can do that by adding the following code below the WP_DEBUG line.

  // Enable Debug logging to the /wp-content/debug.log file
  define( 'WP_DEBUG_LOG', true );

  // Disable display of errors and warnings 
  define( 'WP_DEBUG_DISPLAY', false );
  @ini_set( 'display_errors', 0 );

Hope that helps.

Where can I find the file to add the WP_DEBUG code?

Hi @Joyce82,

You can find the WP_DEBUG in your wp-config.php file. To locate the wp-config.php files go to your root directory using a filemanager or FTP and you can find the wp-config.php on that location.

Hope that helps.

Thank you.

Hi,
The content of my wp-config.php file does not contain the WP_DEBUG line. Please advise me where to insert the code provided by Christian. Thank you!

Hello Ko-Ching,

The wp-config.php file should always have the debug mode and it is set to false by default. Kindly check this codex:

In the meantime, you may also check out the wp-config-sample.php where it usually has this content:

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** MySQL database username */
define( 'DB_USER', 'username_here' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/support/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Hope this helps.

Hi,

I added the wp-debug code and asked the webhost provider to update to php7.4

However, only the home page looks fine. When I try to link to other pages or posts from home page, it shows the 404 page not found error.

Please shed some light. I’m using the Church theme. Is it not compatible with the latest php?

url: supersleeper.co

Somehow fixed it by fiddling back and forth with Permalinks settings in the Wordpress interface.

Switching from my preferred option Post Name to Plain, then “save”
And then switch back to Post Name, then “save”

I didn’t know what did the trick though. Perhaps it simply takes time to fully process php update?

Anyway, my site is working again now.

Hi @Joyce82

In this case, you would have needed to update the permalinks.

This is why you had a 404 error and now that you adjusted and went back to normal it is working fine.

Hope that helps for future :slight_smile:

Hi @Joyce82,

Great that your site start working now.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.