Hello,
This may be a bit tricky, but here is the situation:
The client got new VPS this week. And same working code gives me errors.

$product_data->$fld['name'] = get_field($fld['name'], $product->ID);

This gives me error

array to string convertion

Now if I fix it with curly brackets like this:

$product_data->{$fld['name']} = get_field($fld['name'], $product->ID);

Its fine.

This is pretty much the same setup on old and new servers. CentOS, WHM, CPanel, Apache 2.4, PHP 5.6. All latest compiled with easy apache 4.
Difference on old server is easy apache 3.

Can someone shade some light on it?

Thanks

    Nope. There is a multiphp there and I set 5.6. Its wordpress and with 7.0 it gives me ton of errors.
    The only thing is that in WHM the default php is 7.0, but it shouldn't matter since I set 5.6 on this domain I think..

      If you have one server working and the other spitting tons of errors, it might be due to differences between PHP 5.6 and PHP 7, but I suspect it might more likely be due to differences in your error_reporting and display_errors settings betweeen the machines.

        What was the version of PHP on the old server?

          Update/Solution:
          The weirdest thing: So this is WHM+CPanel as we all know. The WHM was set php 7.0.18 as default. Now in CPanel multiphp I have changed it to php 5.6.30 as stated above.
          I can even witness that in the beginning it was on php7 and wordpress didnt work. It only started working when changed to php5.6. Now with this setting (php 5.6) I go to woocommerce "System Status" page. And it shows php 7.0.18 !!!
          So I went back to WHM and set 5.6.30 as default and all is fine.
          I would say it was some kinda mutation of 5.6 and 7 courtesy of CPanel team ))

            Write a Reply...