soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
314 stars 29 forks source link

4.0 beta 2 another warning #2818

Open pogeunpark opened 2 years ago

pogeunpark commented 2 years ago

Describe the bug

When trying to preview a previous revision, a warning shows up instead of the preview.

===========================

( ! ) Warning: Attempt to read property "meta_value" on null in /Users/pogeunpark/Local Sites/oxygen/app/public/wp-content/plugins/oxygen/component-framework/component-init.php on line 2206 Call Stack

Time Memory Function Location

1 16797280507.2687 374720 {main}( ) .../index.php:0 2 16797280507.2687 375032 require( '/Users/pogeunpark/Local Sites/oxygen/app/public/wp-blog-header.php ) .../index.php:17 3 16797280507.2687 8706320 require_once( '/Users/pogeunpark/Local Sites/oxygen/app/public/wp-includes/template-loader.php ) .../wp-blog-header.php:19 4 16797280507.2687 8792664 include( '/Users/pogeunpark/Local Sites/oxygen/app/public/wp-content/plugins/oxygen/component-framework/oxygen-main-template.php ) .../template-loader.php:106 5 16797280507.2687 8796520 wp_head( ) .../oxygen-main-template.php:10 6 16797280507.2687 8796520 do_action( ) .../general-template.php:3042 7 16797280507.2687 8796896 WP_Hook->do_action( ) .../plugin.php:474 8 16797280507.2687 8796896 WP_Hook->apply_filters( ) .../class-wp-hook.php:331 9 16797280507.2687 9227584 oxy_print_cached_css( ) .../class-wp-hook.php:307 10 16797280507.2687 9234704 do_action( ) .../component-init.php:1194 11 16797280507.2687 9235080 WP_Hook->do_action( ) .../plugin.php:474 12 16797280507.2687 9235080 WP_Hook->apply_filters( ) .../class-wp-hook.php:331 13 16797280507.2687 9236208 add_web_font( ) .../class-wp-hook.php:307 14 16797280507.2687 9246968 ct_template_shortcodes( ) .../component-init.php:4293 15 16797280507.2687 9247416 oxygen_get_combined_shortcodes( ) .../component-init.php:2180 16 16797280507.2687 9244480 oxygen_get_combined_shortcodes( ) .../component-init.php:2224

=============================

Steps to reproduce the behavior:

  1. Make a template which applies to all pages. Work on some edits in the Oxygen editor.
  2. Save and generate a revision.
  3. Preview the revision
  4. See the error above.

If you can't fill out the above information, you should not be filing a bug report. Instead, contact us via https://oxygenbuilder.com/support with the details you have and we'll investigate your issue further.

maltmann-muc commented 2 years ago

4.0.4RC1

On each Oxygen Builder page save, warnings like this:

PHP Warning: Undefined array key 21 in /{path}/wp-content/plugins/oxygen/component-framework/includes/revisions.php on line 48 PHP Warning: Attempt to read property "meta_value" on null in /{path}/wp-content/plugins/oxygen/component-framework/includes/revisions.php on line 48

Missing check for existence of object property meta_value.

if( intval( $dates[ $last_date_for_daily_revisions ]->meta_value) - intval( $dates[ $index ]->meta_value ) < 86400 ) {

On Save, there are two calls to Oxygen_Revisions::create_revision(). The first call has e.g. $last_date_for_daily_revisions = 19 $index = 20

The second call has $last_date_for_daily_revisions = 19 $index = 21 But $dates[21] doesn't exist.