Amblymoron
Amblymoron

Reputation: 31

How to fix a specific Declaration of case-insensitive constants is deprecated warning

I have a Wordpress plugin that is no longer maintained but I have not found any plugin that satisfactorily replaces it. As a result, updates to PHP are starting to generate warnings in the plugin. I have little PHP knowledge and am not sure what, exactly, I need to do to update the following snippet so as to avoid the warning "Declaration of case-insensitive constants is deprecated" under PHP 7.3.

Here is the snippet:

$uploads = wp_upload_dir();

define( 'DOIFD_SERVICE', '', true );
define( 'DOIFD_VERSION', '2.1.6' );
define( 'DOIFD_URL', plugin_dir_url( __FILE__ ) );
define( 'DOIFD_DIR', plugin_dir_path( __FILE__ ) );
define( 'DOIFD_DOWNLOAD_DIR', $uploads[ 'basedir' ] . '/doifd_downloads/' );
define( 'DOIFD_DOWNLOAD_URL', $uploads[ 'baseurl' ] . '/doifd_downloads/' );
define( 'DOIFD_IMG_URL', plugin_dir_url( __FILE__ ) . 'public/assets/img/' );
define( 'DOIFD_ADMIN_IMG_URL', plugin_dir_url( __FILE__ ) . 'admin/assets/img/' );

Upvotes: 3

Views: 20476

Answers (3)

shailu
shailu

Reputation: 330

code is different i use "SaFly-Curl-Patch" third party plugin for solving php error there is same error so to fix it, goto plugin folder find edit safly plugin,

define('SCP_INC', 'safly', TRUE);

To

define('SCP_INC', 'safly');

probably on line no 26, hope this work for you!

Upvotes: 0

Kaddath
Kaddath

Reputation: 6151

The case_insensitive parameter is no longer supported, so you should remove the third argument (true) from the function call.

In your case, the important part is that you need to check the code to see if DOIFD_SERVICE is used in places where it's not all caps, for example doifd_service, and replace all the instances with all caps DOIFD_SERVICE (there are probably some in the code, or else the parameter would probably not have been set to true)

In other words, replace this:

define( 'DOIFD_SERVICE', '', true );

With this:

define( 'DOIFD_SERVICE', '' );

Upvotes: 10

Wiimm
Wiimm

Reputation: 3552

You have to change

define( 'DOIFD_SERVICE', '', true );
                           ^^^^^^^

to

define( 'DOIFD_SERVICE', '');

An issue can be, that doifd_service and doIFd_Service and ... are not longer defined. If this is important, add

 define( 'doifd_service', '');

Mixed cases (CamelCase) are not usual in combination with underscore.

Upvotes: 3

Related Questions