-1

I am currently receiving the following error

PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in wp-content/plugins/js_composer/include/classes/core/class-vc-mapper.php on line 111

Line of code ...

I am currently receiving the following error

PHP Deprecated: The each() function is deprecated. This message will be suppressed on further calls in wp-content/plugins/js_composer/include/classes/core/class-vc-mapper.php on line 111

Line of code ...

protected function callActivities() {
    do_action( 'vc_mapper_call_activities_before' );
    while ( $activity = each( $this->init_activity ) ) { // <<<< LINE 111
        list( $object, $method, $params ) = $activity[1];
        if ( 'mapper' === $object ) {
            switch ( $method ) {
                case 'map':
                    WPBMap::map( $params['tag'], $params['attributes'] );
                    break;
                case 'drop_param':
                    WPBMap::dropParam( $params['name'], $params['attribute_name'] );
                    break;
                case 'add_param':
                    WPBMap::addParam( $params['name'], $params['attribute'] );
                    break;
                case 'mutate_param':
                    WPBMap::mutateParam( $params['name'], $params['attribute'] );
                    break;
                case 'drop_all_shortcodes':
                    WPBMap::dropAllShortcodes();
                    break;
                case 'drop_shortcode':
                    WPBMap::dropShortcode( $params['name'] );
                    break;
                case 'modify':
                    WPBMap::modify( $params['name'], $params['setting_name'], $params['value'] );
                    break;
            }
        }
    }
}

Would anyone know to help me solve this problem? How do I fix it?

Gilberto
  • 1
  • 1
  • 1
  • 3
  • 1
    Look into [`foreach`](https://www.php.net/manual/en/control-structures.foreach.php). – Jeto Jan 01 '20 at 15:51
  • 1
    'PHP Deprecated' upgrade that function to work with the current PHP or software upgrade –  Jan 01 '20 at 15:53
  • Update the WP plugin if possible. If not, be prepared for it to stop working in future versions of PHP (8+). – Jirka Hrazdil Jan 01 '20 at 16:35

2 Answers2

5
foreach ( $this->init_activity as $activity ) {

thanks https://www.thetopsites.net/article/52516077.shtml

Achi
  • 51
  • 1
  • 3
0

The issue is most likely associated with the WP Bakery version that comes as a necessary plugin to run your theme. I did the following:

  • changed the theme to the default one.
  • Uploaded a fresh zip copy of the theme
  • Reinstalled and enabled it.

The issue was resolved.