#24539 closed defect (bug) (fixed)
Imagick gives E_STRICT notice on PHP 5.4 due to queryFormats() static call
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
While using imagick, an E_STRICT notice is generated when queryFormats() is called statically:
https://bugs.php.net/bug.php?id=64945
If a PHP module specifies ZEND_ACC_ALLOW_STATIC, then calling that method statically creates this warning:
Strict Standards: Non-static method Imagick:queryformats() should not be called
statically in /wp-includes/class-wp-image-editor-imagick.php on line 100
Since the author is intentionally allowing static calls (and this particular check does not depend on the specific instance), it's not ideal that PHP has this behavior, since we are using the module as it is intended.
It seems like there are a couple of options:
1) We could add an @ in front of the call
2) We could temporarily create an Imagick object that we don't load anything into, and use that, then destroy it.
I don't particularly like either option, but there it is.
Initial patches attached.
Attachments (2)
Change History (8)
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
12 years ago
Replying to nacin:
If this is a bug in Imagick, I would just eat the E_STRICT (as in, wontfix) until it gets fixed upstream.
Based on the information I have at the moment, it seems like more of a PHP 5.4 _doing_it_wrong() in terms of over-enforcement of class design, but agreed that upstream Imagick can work around this problem in a more future-compatible way.
As mentioned in the bug report, I am not a fan of either of the options available to us for suppressing/working around the notice. If we're fine with the notice existing on PHP 5.4 under Imagick until it's updated upstream (and with hosts), then I'm fine with that.
The downside is that In the meantime, if WP_DEBUG is enabled on PHP 5.4 and Imagick is used, then some things will break (like image edit previews) while it remains enabled.
#4
in reply to:
↑ 3
@
12 years ago
Replying to DH-Shredder:
The downside is that In the meantime, if WP_DEBUG is enabled on PHP 5.4 and Imagick is used, then some things will break (like image edit previews) while it remains enabled.
I don't think breaking is acceptable. I'd go with the @-silencing.
If this is a bug in Imagick, I would just eat the E_STRICT (as in, wontfix) until it gets fixed upstream.