#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–%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)
Change History (3)
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:
...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:
- 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. - Drop the
WP_Errorreturn as dead code.
Happy to follow up with whichever is preferred.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
[14188]