-
AuthorPosts
-
October 9, 2019 at 9:24 pm #1146642
I am seeing the following errors:
PHP Notice: Trying to get property of non-object in /var/www/html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 66
Notice: Trying to get property of non-object in /var/www/html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 66
PHP Notice: Undefined variable: main_color in /var/www/html/wp-content/themes/enfold/css/dynamic-css.php on line 35
Notice: Undefined variable: main_color in /var/www/html/wp-content/themes/enfold/css/dynamic-css.php on line 35
PHP Notice: Undefined variable: primary in /var/www/html/wp-content/themes/enfold/css/dynamic-css.php on line 47
Notice: Undefined variable: primary in /var/www/html/wp-content/themes/enfold/css/dynamic-css.php on line 47
PHP Notice: Undefined variable: primary in /var/www/html/wp-content/themes/enfold/css/dynamic-css.php on line 52
Notice: Undefined variable: primary in /var/www/html/wp-content/themes/enfold/css/dynamic-css.php on line 52I tried following this: https://kriesi.at/support/topic/trying-to-get-property-of-non-object-in-function-set-avia-frontend-php-line-66/
But I cannot find this: “Perhaps try disable Enfold Theme Options > Performance > JS & CSS file merging and compression or disable Autoptimize as there maybe a conflict.”
I am here:
https://<host>/wp-admin/admin.php?page=aviaand when I click on “Theme Options” I don’t see “Performance > JS & CSS file merging and compression”. Any ideas what I’m doing wrong?
October 10, 2019 at 11:18 am #1146824Hey oneskysandy,
Sorry for the problem. Please send us a temporary WordPress admin login and login URL so that we can have a closer look. You can post the details in the Private Content section of your reply.
Best regards,
RikardOctober 10, 2019 at 9:26 pm #1146956I realized this only happens when I’m using the WordPress command line utility and doesn’t occur during regular site usage. As long as it doesn’t affect the website, I don’t have a huge issue with it.
Nonetheless, I’ve created the login credentials if you’re interested.
October 12, 2019 at 5:19 am #1147306Hi,
Thanks for the update, so that comes up in the server logs only when you work on the site using the command line? I don’t think it’s much to worry about since they are only notices, they’re not really errors so to say.
Best regards,
RikardOctober 16, 2019 at 9:08 am #1148342I don’t think it’s much to worry about since they are only notices, they’re not really errors so to say.
I can’t believe I’m really reading this. These notices clutter our logs with rubbish. The command
wp cache flush
alone triggers ~50 identical messages (amongst other warnings and notices of unfixed bugs in Enfold).they’re not really errors so to say.
Of course these notices are errors. They are triggered by bugs that must be fixed. Which developer ignores PHP notices?
The use of WP-CLI is standard for developers who work professionally (and I thought you do). It frightens me that you don’t seem to be using it.
</rant>
Excuse this rant (please don’t take it personally), but I’m quite upset about your opinion.October 22, 2019 at 7:43 am #1150066Hi,
The use of WP-CLI is standard for developers who work professionally (and I thought you do). It frightens me that you don’t seem to be using it.
I don’t think WP-CLI can be really useful in theme development. It is usually use by site managers to streamline their maintenance process. And also use to automate site creation in a managed hosting environment. It doesn’t really provide any advantage on theming, which is what we do, unless you’re doing devops aside.
. The command wp cache flush alone triggers ~50 identical
What kind of values are you saving in the cache object? And what kinds of errors are you getting from using the wp cache flush command?
Best regards,
IsmaelDecember 11, 2019 at 4:36 pm #1164870The command
wp cache flush
alone triggers ~50 identical messagesWhat kind of values are you saving in the cache object? And what kinds of errors are you getting from using the
wp cache flush
command?This is the output of
wp cache flush
that is called during our deployment (Enfold v4.6.3.1):Warning: Illegal string offset 'product_gallery' in /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/config-woocommerce/config.php on line 190 Warning: Cannot assign an empty string to a string offset in /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/config-woocommerce/config.php on line 190 Warning: Illegal string offset 'product_gallery' in /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/config-woocommerce/config.php on line 193
I no longer get the notices the OP (@oneskysandy) described though. They seem to have been fixed.
However, in addition to the warnings mentioned above, the theme generates a fatal error when
wp cache flush
is called, which causes the deployment to fail:Fatal error: Uncaught Error: Call to a member function reset_options() on null in /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/functions-enfold.php:1844 Stack trace: #0 /path/to/project/deploy/releases/45/public/wp/wp-includes/class-wp-hook.php(288): avia_generate_stylesheet('') #1 /path/to/project/deploy/releases/45/public/wp/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array) #2 /path/to/project/deploy/releases/45/public/wp/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #3 /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/framework/php/function-set-avia-backend.php(91): do_action('ava_after_theme...') #4 /path/to/project/deploy/releases/45/public/wp/wp-includes/class-wp-hook.php(288): avia_update_helper->update_version('') #5 /path/to/project/deploy/releases/45/public/wp/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array) #6 /path/to/project/deploy/releases/45/public/wp/wp-includes/plugin.php(478): WP_Hook->do_action(A in /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/functions-enfold.php on line 1844
December 13, 2019 at 5:20 am #1165405Hi,
Thank you for following up.
Warning: Illegal string offset ‘product_gallery’ in /path/to/project/deploy/releases/45/public/wp-content/themes/enfold/config-woocommerce/config.php on line 190
To fix that issue, please edit the file mentioned in the stack trace and look for this code around line 190..
if( empty( $options['product_gallery'] ) )
.., then replace it with:
if( ! array_key_exists( 'product_gallery', $options ) || ( 'wc_30_gallery' != $options['product_gallery'] ) )
That should remove the warning.
For the fatal error, try to add this code in the functions.php file temporarily before doing the flush.
remove_action('ava_after_theme_update', 'avia_generate_stylesheet', 30, 1);
which causes the deployment to fail:
Are you using a bash deployment script?
Best regards,
IsmaelDecember 13, 2019 at 9:21 am #1165434Hi @ismael,
Are you using a bash deployment script?
Our deployment setup looks as follows:
- WordPress core, free and paid plugins and the theme are managed by Composer using WP Starter v3 (paid plugins and the theme are distributed by a custom SatisPress instance)
- The root “website repository” only contains the
composer.json
andcomposer.lock
files (simply put) - Pushing code changes of the website repository to our VCS (currently private Bitbucket repositories) will trigger a build in Codeship
- In the Codeship build, Composer installs the project
- The complete project will then be shipped to the target host by Deployer using rsync
- Using custom Deployer steps, we execute various commands on the target system before and after shipping, among them are some WP-CLI commands
One of these steps is
wp cache flush
which fails on the latest Enfold version with the error described in my previous post.To fix that issue, please edit the file mentioned in the stack trace and look for this code around line 190.
Even if it is possible to patch packages with composer-patches, I don’t want to. As soon as even one character in the to be patched code changes, it will fail. This means that we’d have to check whether the patch still applies every time there’s a theme update.
Instead, you should change that line in the code and release the fix in a future update.For the fatal error, try to add this code in the
functions.php
file temporarily before doing the flush.This is not doable because this would require code changes before and after executing the command. Finding the root cause for this and fixing it on your side also applies here.
Thanks.
December 13, 2019 at 10:23 am #1165450Hi,
Thank you for the info.
The product_gallery patch is going to be included in the next release but there’s no ETA yet.
Have you tried disabling the theme before doing the flush? Activate it back once the flush is done.
// https://developer.wordpress.org/cli/commands/theme/activate/
UPDATE: I can’t find the command to deactivate a theme, but this might work:
// https://developer.wordpress.org/cli/commands/theme/disable/
Or try to skip the theme during the flush.
// https://make.wordpress.org/cli/handbook/identify-plugin-theme-conflict/
You probably don’t need the theme to be active during the deployment or the patch.
We’ll tag one of our developers so that he can check the thread and provide additional assistance.
Best regards,
IsmaelDecember 13, 2019 at 4:26 pm #1165575Hi @ismael,
Have you tried disabling the theme before doing the flush? Activate it back once the flush is done.
If
wp cache flush
is executed on the target host, the new release has already been activated. It is therefore not possible to disable the theme, as it cannot be ruled out that visitors are already on the site.The right approach to this problem would be to ensure that Enfold works in professional environments. The use of WP-CLI is a de facto standard and when developing new features or fix existing ones it is therefore important to ensure that WP-CLI commands do not generate PHP errors.
I hope your developers understand how important it is to provide a theme for professional use.
Thanks.December 14, 2019 at 2:46 pm #1165868Hi,
Thanks for reporting this.
I think I could locate the problem:
In enfold\framework\avia_framework.php line96:
$avia = AviaSuperobject( $avia_base_data );
Replace this with:
global $avia; $avia = AviaSuperobject( $avia_base_data );
Will be part of the next update.
If you need assistance with the update let us know.
Best regards,
GünterDecember 16, 2019 at 9:11 am #1166264Hi @guenter,
thanks for the update. Let’s see if the errors mentioned in this thread will be fixed with the next update. I will test the update on our Stage system as soon as it has been released and will report accordingly.Thanks.
December 18, 2019 at 2:40 am #1167070Hi,
The latest version will probably be released after the holidays or early next year. You may have to modify the files manually for now. Thank you for your patience.
Best regards,
IsmaelFebruary 5, 2020 at 12:00 am #1181584The next release came out (January 21th – Version 4.7.2) and the fix is not included.
Can you please give us a version to expect it in?
This bug throws a bunch of warnings with every use of the wp-cli.
- This reply was modified 4 years, 9 months ago by Jason.
February 11, 2020 at 10:59 am #1183385Hi,
@Jason
Fix https://kriesi.at/support/topic/trying-to-get-property-of-non-object-5/#post-1165868 was already included in 4.7.2 – and is also in 4.7.3.
Make sure to clear all server cache.
If this does not fix your problem please explain exactly what you are doing so we can try to reproduce it (and also a copy of the error log so we can locate the problem).
Best regards,
GünterFebruary 26, 2020 at 5:37 am #1187953The fix you described above in post #1165405 is not included.
All you need to do is execute any wp-cli command and you will see errors relating to line 190 of the file mentioned in that post.
admin@:/path$ wp plugin status PHP Warning: Illegal string offset 'product_gallery' in /path/wp-content/themes/enfold/config-woocommerce/config.php on line 190 Warning: Illegal string offset 'product_gallery' in /path/wp-content/themes/enfold/config-woocommerce/config.php on line 190 PHP Warning: Cannot assign an empty string to a string offset in /path/wp-content/themes/enfold/config-woocommerce/config.php on line 190 Warning: Cannot assign an empty string to a string offset in /path/wp-content/themes/enfold/config-woocommerce/config.php on line 190 PHP Warning: Illegal string offset 'product_gallery' in /path/wp-content/themes/enfold/config-woocommerce/config.php on line 193 Warning: Illegal string offset 'product_gallery' in /path/wp-content/themes/enfold/config-woocommerce/config.php on line 193
February 28, 2020 at 7:21 am #1188766Hi,
Thank you for the update.
The fix that we provided above (#1165405) is already included in the latest version of the theme.
// https://kriesi.at/support/topic/trying-to-get-property-of-non-object-5/#post-1165405
Please make sure that the theme is upgraded to version 4.7.3.
Best regards,
IsmaelFebruary 28, 2020 at 1:08 pm #1188822I am running 4.7.3. Have you tried to replicate the issue?I thought I was on 4.7.3 but the upgrade failed. After upgrading to 4.7.3 the error is gone. Thanks!
- This reply was modified 4 years, 8 months ago by Jason. Reason: PICNIC
February 29, 2020 at 8:57 am #1188989 -
AuthorPosts
- The topic ‘Trying to get property of non-object’ is closed to new replies.