Skip to content

Commit

Permalink
Explicitly checking for false to safeguard a match at position 0 of $…
Browse files Browse the repository at this point in the history
…content, which would satisfy the if-statement's condition. (#38505)
  • Loading branch information
ramonjd committed Feb 4, 2022
1 parent c27f1df commit 037c82b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function render_block_core_image( $attributes, $content ) {
// which now wraps Image Blocks within innerBlocks.
// The data-id attribute is added in a core/gallery `render_block_data` hook.
$data_id_attribute = 'data-id="' . esc_attr( $attributes['data-id'] ) . '"';
if ( ! strpos( $content, $data_id_attribute ) ) {
if ( false === strpos( $content, $data_id_attribute ) ) {
$content = str_replace( '<img', '<img ' . $data_id_attribute . ' ', $content );
}
}
Expand Down

0 comments on commit 037c82b

Please sign in to comment.