Index: /trunk/src/wp-includes/media.php
===================================================================
--- /trunk/src/wp-includes/media.php (revision 48238)
+++ /trunk/src/wp-includes/media.php (revision 48239)
@@ -1589,5 +1589,5 @@
}
- // Add extra attributes to the image markup.
+ // Add the srcset and sizes attributes to the image markup.
return preg_replace( '/]+?)[\/ ]*>/', '', $image );
}
@@ -1738,5 +1738,5 @@
// Images should have source and dimension attributes for the `loading` attribute to be added.
- if ( false === strpos( $image, ' src=' ) || false === strpos( $image, ' width=' ) || false === strpos( $image, ' height=' ) ) {
+ if ( false === strpos( $image, ' src="' ) || false === strpos( $image, ' width="' ) || false === strpos( $image, ' height="' ) ) {
return $image;
}
Index: /trunk/tests/phpunit/tests/media.php
===================================================================
--- /trunk/tests/phpunit/tests/media.php (revision 48238)
+++ /trunk/tests/phpunit/tests/media.php (revision 48239)
@@ -2684,4 +2684,14 @@
$this->assertNotContains( ' loading="lazy"', $img );
}
+
+ /**
+ * @ticket 50367
+ */
+ function test_wp_img_tag_add_loading_attr_with_single_quotes() {
+ $img = "";
+ $img = wp_img_tag_add_loading_attr( $img, 'test' );
+
+ $this->assertNotContains( ' loading="lazy"', $img );
+ }
}