Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 8 weeks ago

#13082 closed defect (bug) (fixed)

Wrong variable for page_links_text in ms-sites and ms-users

Reported by: ocean90 Owned by:
Priority: normal Milestone: 3.0
Component: Multisite Version: 3.0
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

<?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
		number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),
		number_format_i18n( min( $pagenum * $per_page, $num_pages) ),
		number_format_i18n( $num_pages),
		$page_links
); echo $page_links_text; ?>

Instead of $num_pages it should be $total.

Attachments (1)

13082.patch​ (1.3 KB ) - added by ocean90 16 years ago.

Download all attachments as: .zip

Change History (3)

@ocean90
16 years ago

#1 @ocean90
16 years ago

  • Resolution → fixed
  • Status new → closed

This ticket was mentioned in ​PR #13200 on ​WordPress/wordpress-develop by ​@mazharul78.


8 weeks ago
#2

Trac ticket: _to be filed; will update this line with the ticket URL._

## Problem

WP_Image_Editor_Imagick::remove_pdf_alpha_channel() was introduced in [56271] (#39216, WordPress 6.4). It returns a WP_Error object when Imagick::setImageAlphaChannel() throws:

} catch ( Exception $e ) {
    return new WP_Error( 'pdf_alpha_process_failed', $e->getMessage() );
}

Its DocBlock declares no return value at all:

/**
 * Removes PDF alpha after it's been read.
 *
 * @since 6.4.0
 */
protected function remove_pdf_alpha_channel() {

## Why this was not caught by the existing sweeps

PHPStan's return.missing rule only fires when a return type is declared. Because this method declares none, it stayed silent — while its sibling set_imagick_time_limit(), in this same file, is being fixed for that exact rule in #13082 (Trac #65817).

## This PR

Documents the existing return value. No behavior change, no new PHPCS errors (WordPress-Docs commenting sniffs report the same 13 pre-existing errors in this file before and after).

## Open question for a committer

The sole caller discards the return value:

​https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-image-editor-imagick.php#L371-L373

...even though the adjacent pdf_load_source() and ->valid() results are both error-checked. Two possible follow-ups, both behavior-affecting and deliberately left out of this PR:

  1. Propagate the error from load() — but a failed alpha strip would then abort PDF preview generation entirely, rather than yielding a preview with a black background. That may be worse for users.
  2. Drop the WP_Error return as dead code.

Happy to follow up with whichever is preferred.

Note: See TracTickets for help on using tickets.