Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] PHP 8 Warning: mysqli_query(): The regular expression contains an unclosed bracket expression. #123

Open
jessecowens opened this issue Jul 6, 2021 · 9 comments · May be fixed by #165 or #190
Assignees

Comments

@jessecowens
Copy link
Member

Describe the bug
Running PHP 8, the following warnings are thrown when BoldGrid Inspirations is active on every administration screen:

Warning: mysqli_query(): (HY000/3696): The regular expression contains an unclosed bracket expression. in /home/jesseo/Local Sites/inspirations80/app/public/wp-includes/wp-db.php on line 2056
--
1 | 16821136119.5229 | 367296 | {main}( ) | .../post.php:0
2 | 16821136119.5229 | 15586720 | require( '/home/jesseo/Local Sites/inspirations80/app/public/wp-admin/edit-form-advanced.php ) | .../post.php:206
3 | 16821136119.5229 | 15649624 | require_once( '/home/jesseo/Local Sites/inspirations80/app/public/wp-admin/admin-header.php ) | .../edit-form-advanced.php:425
4 | 16821136119.5229 | 16160840 | do_action( ) | .../admin-header.php:252
5 | 16821136119.5229 | 16161216 | WP_Hook->do_action( ) | .../plugin.php:484
6 | 16821136119.5229 | 16161216 | WP_Hook->apply_filters( ) | .../class-wp-hook.php:316
7 | 16821136119.5229 | 16162344 | wp_admin_bar_render( ) | .../class-wp-hook.php:292
8 | 16821136119.5229 | 16163128 | do_action_ref_array( ) | .../admin-bar.php:95
9 | 16821136119.5229 | 16163128 | WP_Hook->do_action( ) | .../plugin.php:551
10 | 16821136119.5229 | 16163128 | WP_Hook->apply_filters( ) | .../class-wp-hook.php:316
11 | 16821136119.5229 | 16197744 | Boldgrid_Inspirations_Purchase_For_Publish->toolbar_link_to_mypage( ) | .../class-wp-hook.php:292
12 | 16821136119.5229 | 16198120 | Boldgrid_Inspirations_Purchase_For_Publish->get_total_cost_to_purchase_for_publishing( ) | .../class-boldgrid-inspirations-purchase-for-publish.php:683
13 | 16821136119.5229 | 16199312 | Boldgrid_Inspirations_Purchase_For_Publish->create_array_assets_needing_purchase( ) | .../class-boldgrid-inspirations-purchase-for-publish.php:189
14 | 16821136119.5229 | 16277896 | Boldgrid_Inspirations_Purchase_For_Publish->asset_needs_purchase( ) | .../class-boldgrid-inspirations-purchase-for-publish.php:868
15 | 16821136119.5229 | 16278984 | wpdb->get_var( ) | .../class-boldgrid-inspirations-purchase-for-publish.php:1310
16 | 16821136119.5229 | 16278984 | wpdb->query( ) | .../wp-db.php:2581
17 | 16821136119.5229 | 16261272 | wpdb->_do_query( ) | .../wp-db.php:1945
18 | 16821136119.5229 | 16261272 | mysqli_query ( ) | .../wp-db.php:2056

To Reproduce
Steps to reproduce the behavior:

  1. Enable debug display on PHP 8
  2. Install and activate BoldGrid Inspirations

Additional context
These warnings were reported by DreamHost, and replicated on a local installation using PHP 8

@jessecowens
Copy link
Member Author

@bwmarkle This isn't causing any known major issues, but it has been blamed for unrelated issues when examining debug logs

@jessecowens
Copy link
Member Author

@bwmarkle
Copy link
Contributor

bwmarkle commented Nov 9, 2022

@jamesros161 can you help out with this one?

@jamesros161
Copy link
Collaborator

@jamesros161 can you help out with this one?

Looking into it

@looscrew
Copy link

Getting the same. (w/ DreamHost, PHP 8)
Will there be a fix? Admin area is polluted with these warnings.

@jessecowens
Copy link
Member Author

Getting the same. (w/ DreamHost, PHP 8) Will there be a fix? Admin area is polluted with these warnings.

Hi @looscrew - The best immediate fix is to disable WP_DEBUG_DISPLAY in your wp_config.php file. The message itself is just a warning, and doesn't affect operation of the site. Keeping WP_DEBUG_DISPLAY set to false is a good idea in general, because it can show errors to your visitors too. Check out this article on WP_DEBUG.

@looscrew
Copy link

Hi @jessecowens, thanks for the response.
I'm on a staging site. Debug is on and as I'm in development. The warnings go into the log file too, getting mixed with the real errors. Kind of a pain. I hope this gets resolved.

@jessecowens
Copy link
Member Author

Hi @looscrew -
Thanks for the additional info! I spoke to @jamesros161 and we have a potential fix for the problem. We're doing a little testing to make sure it's the right fix, and should have a release ready soon.

If you'd like to help us test the fix, change line 1300 of includes/class-boldgrid-inspirations-purchase-for-publish.php to the following:

		$regexp = '[\\[][^\\]]+[\'\", ]' . $attachment_id . '[^0-9]+.*[\\]]';

If you'd rather just clean up your logs and admin screen, and you've already installed an Inspiration on your staging site, you could also temporarily deactivate the plugin to clean up your logs, the only functionality you'll be missing is the Connect Search stock photo library.

@looscrew
Copy link

Hi @jessecowens.
I changed line 1300 as suggested. Unfortunately the warnings continue. In addition I killed the PHP process, deleted cache and did hard refresh. To no avail.

I appreciate the care.

@jamesros161 jamesros161 linked a pull request Dec 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants