WordPress 7.1.3
This commit is contained in:
@@ -183,11 +183,15 @@ function export_wp( $args = array() ) {
|
||||
)
|
||||
);
|
||||
|
||||
// Cast thumbnail IDs to integers to prevent second-order SQL injection via user-controlled meta values.
|
||||
$thumbnails_ids = array_filter( array_map( 'absint', $thumbnails_ids ) );
|
||||
|
||||
$additional_ids = array_merge( $additional_ids, $attachment_ids, $thumbnails_ids );
|
||||
}
|
||||
|
||||
// Merge the additional IDs back with the original post IDs after processing all posts
|
||||
$post_ids = array_unique( array_merge( $post_ids, $additional_ids ) );
|
||||
// Merge the additional IDs back with the original post IDs after processing all posts.
|
||||
// Cast to integers as defense-in-depth, since $additional_ids may include values sourced from postmeta.
|
||||
$post_ids = array_unique( array_map( 'absint', array_merge( $post_ids, $additional_ids ) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -597,8 +601,10 @@ function export_wp( $args = array() ) {
|
||||
|
||||
// Fetch 20 posts at a time rather than loading the entire table into memory.
|
||||
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
|
||||
$where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')';
|
||||
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
|
||||
// Re-sanitize immediately before use, as defense-in-depth against the IDs being interpolated directly into SQL below.
|
||||
$next_posts = array_map( 'absint', $next_posts );
|
||||
$where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')';
|
||||
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
|
||||
|
||||
// Begin Loop.
|
||||
foreach ( $posts as $post ) {
|
||||
|
||||
@@ -1083,10 +1083,15 @@ function wp_read_image_metadata( $file ) {
|
||||
* @since 7.0.0
|
||||
*
|
||||
* @param string $file File path to the image.
|
||||
* @return string Embedded alternative text.
|
||||
* @return string Embedded alternative text, empty when there is no alt text or DOM extension is not installed.
|
||||
*/
|
||||
function wp_get_image_alttext( $file ) {
|
||||
$alt_text = '';
|
||||
$alt_text = '';
|
||||
|
||||
if ( ! class_exists( 'DOMDocument', false ) ) {
|
||||
return $alt_text;
|
||||
}
|
||||
|
||||
$img_contents = file_get_contents( $file );
|
||||
|
||||
if ( false === $img_contents ) {
|
||||
|
||||
Reference in New Issue
Block a user