Jump to content

[1.6.1.7] [PHP7] Visual Composer Array to string conversion


Recommended Posts

Hello!

 

After installing Visual Composer module for Prestashop 1.6.1.7 with PHP 7 I am getting this error:
 

    Notice w linii 74 w pliku l/public_html/modules/jscomposer/include/classes/shortcodes/vc-row.php
    [8] Array to string conversion

The problem is with this line:

    $param_value = isset( $$param['param_name'] ) ? $$param['param_name'] : '';

I guess that is a PHP problem. What can be wrong with this particular line?
Here is more from that file:
 

            if ( isset( $this->settings['params'] ) ) {
                $inner = '';
                foreach ( $this->settings['params'] as $param ) {
                    $param_value = isset( $$param['param_name'] ) ? $$param['param_name'] : '';
                    if ( is_array( $param_value ) ) {
                        // Get first element from the array
                        reset( $param_value );
                        $first_key = key( $param_value );
                        $param_value = $param_value[$first_key];
                    }
                    $inner .= $this->singleParamHtmlHolder( $param, $param_value );
                }
                $output .= $inner;

Thanks for your help!

Edited by stanleyek18 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Hi, if anybody is interested.. the better solution for php is:

 

$param_value = !empty(${$param['param_name']} ) ? ${$param['param_name']} : '';

Because above solution will only erase the warning but actually will not put the right value into the var...

 

also see:

http://php.net/manual/de/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...