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

4.0: ext/get-the-image.php needs PHP 7.3 compatibility upgrade for compact() #173

Open
lkraav opened this issue Jun 9, 2019 · 2 comments
Assignees
Labels

Comments

@lkraav
Copy link

lkraav commented Jun 9, 2019

compact() behavior was changed in PHP 7.3 and get-the-image.php usage of it should probably be rearchitected https://github.com/justintadlock/hybrid-core/blob/4.0.0/ext/get-the-image.php#L298

If left unattended, it's likely that people's error logs will be flooded with Notice | compact(): Undefined variable: post_id | 51 | wp-content/themes/hybrid-core-4.0/ext/get-the-image.php:298.

For example on a category page for me this notice trigger 1800 times per page load (many featured images).

https://www.php.net/manual/en/function.compact.php

EDIT https://core.trac.wordpress.org/ticket/44416

@justintadlock
Copy link
Member

I'd recommend switching to Hybrid Carbon, even if on 4.0 of the framework: https://github.com/justintadlock/hybrid-carbon

@lkraav
Copy link
Author

lkraav commented Jun 9, 2019

Thanks. That's a good idea.

While we get ourselves migrated, can you drop a hint on what could be a good strategy to optimize compact() out of $key = md5( serialize( compact( array_keys( $this->args ) ) ) ); caching?

I'm not entirely sure why it's there in the first place, why not just serialize $this->args directly?

lkraav added a commit to lkraav/hybrid-core that referenced this issue Oct 23, 2019
@saas786 saas786 self-assigned this Mar 11, 2021
@saas786 saas786 added the v4 label Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants