Repository navigation
PHPStan: Introduce phpstan-strict-rules #86460
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
Changes from all commits
4b1704f
8d4950f
c413594
c06810d
f3ba78c
ca04efe
50cbbe4
9f47b59
68fd493
c87de46
ffbcddd
6062faf
dc956bf
407e176
3c3d899
f90f103
0926ddf
29ff6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,8 +37,13 @@ function render_block_core_legacy_widget( $attributes ) { | |
| } | ||
|
|
||
| if ( isset( $attributes['instance']['encoded'], $attributes['instance']['hash'] ) ) { | ||
| $serialized_instance = base64_decode( $attributes['instance']['encoded'] ); | ||
| if ( ! hash_equals( wp_hash( $serialized_instance ), (string) $attributes['instance']['hash'] ) ) { | ||
| $encoded = $attributes['instance']['encoded']; | ||
| $hash = $attributes['instance']['hash']; | ||
| if ( ! is_string( $encoded ) || ! is_string( $hash ) ) { | ||
| return ''; | ||
| } | ||
| $serialized_instance = base64_decode( $encoded, true ); | ||
| if ( false === $serialized_instance || ! hash_equals( wp_hash( $serialized_instance ), $hash ) ) { | ||
|
Comment on lines
+40
to
+46
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ramonjd This is a fix in the class of errors you identified in #66598 (comment). With block attributes, passing a non-string in to <!-- wp:legacy-widget {"idBase":"text","instance":{"encoded":["x"],"hash":"h"}} /-->So the The addition of the strict param further validates that the string is valid base64 data. Since there's also a hash check on the decoded data, it's not really important. But it shouldn't hurt. It would only impact blocks where someone intentionally added stray non-base64 chars to the base64 data. |
||
| return ''; | ||
| } | ||
| $instance = unserialize( $serialized_instance ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.