ndiego / block-visibility

Conditional visibility controls for all WordPress blocks.
https://www.blockvisibilitywp.com
GNU General Public License v2.0
130 stars 10 forks source link

Warnings thrown by the WP Fusion checker #24

Closed Clorith closed 2 years ago

Clorith commented 3 years ago

Description

When using WP Fusion checks with Block Visibility, warnings are thrown that $attributes are undefined.

This is coming from https://github.com/ndiego/block-visibility/blob/baa04dfcf2cbd0439baee6420357cd240d6338cd/includes/frontend/visibility-tests/wp-fusion.php#L99-L102 wherethe variable is used as part of a filter, but the variable has not been declared prior to this.

The visibility options are still applied as expected at this time, but may not in future versions of PHP or similar with warnings behing served.

Notice: Undefined variable: attributes in /sites/testsite.localhost/files/public/wp-content/plugins/block-visibility/includes/frontend/visibility-tests/wp-fusion.php on line 100

Step-by-step reproduction instructions

  1. Enable debugging on your site
  2. Add a block, and add visibility options with WP Fusion enabled
  3. Visit the front-end of your site where the block should be shown, making sure that no other rules previously would have set $is_visible to true
  4. Observe warnings being thrown once per block that has visibility settings in place.

Expected behavior

No warnings should be generated by the base plugin.

Actual behavior

Warnings are thrown.

System information

ndiego commented 2 years ago

This bug has been fixed in the latest release (2.4.3)