Make WordPress Core

Opened 5 weeks ago

Last modified 12 days ago

#61461 new defect (bug)

The pagination results in the Popular Plugins screen is broken

Reported by: nithins53's profile nithins53 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

If we go to Add Plugins> Popular and select the last page which is 1534 (as of now), then if we start going back to previous pages from there like 1533. 15322, we can see that the result page remains the same.

Testing Environment
WordPress: 6.6-beta2-58392
PHP: 8.2.4
Server: Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.2.4
Database: mysqli (Server: 10.4.28-MariaDB / Client: mysqlnd 8.2.4)
Browser: Chrome 109.0.0.0 (Windows 10/11)
Theme: Twenty Twenty-Four 1.1
MU-Plugins: None activated
Plugins:
WordPress Beta Tester 3.5.5

The issue is present in WordPress 6.5.4 also.

Change History (3)

#2 @ndiego
12 days ago

We looked at this during Contributor Day at WordCamp Canada and don't think this is a Core issue. It might be due to the API that fetches the plugins. cc @dufresnesteven in case you have any ideas here.

#3 @berubenic
12 days ago

Looked into what is sent to the API and what is returned. What stands out to me is the page number in the info Array returned by the API. When the page number sent to the API is greater than 999, the page key in the info Array from the API response is always 999. I debugged this by logging the arguments sent to the API and its response in the wordpress-develop/src/wp-admin/includes/class-wp-plugin-install-list-table.php before and after line 242


error_log( print_r( $args, true ) );

$api = plugins_api( 'query_plugins', $args );

// log the API response
error_log( print_r( $api->info, true ) );

The plugin results changed on page 1508 even though the returned page is 999 (plugin results not logged here to keep things shorter)

[11-Jul-2024 14:58:13 UTC] Array
(
    [page] => 1519
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:58:13 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54667
)

[11-Jul-2024 14:59:46 UTC] Array
(
    [page] => 1518
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:46 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:47 UTC] Array
(
    [page] => 1517
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:47 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:48 UTC] Array
(
    [page] => 1516
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:48 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:48 UTC] Array
(
    [page] => 1515
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:48 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:49 UTC] Array
(
    [page] => 1514
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:49 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:50 UTC] Array
(
    [page] => 1513
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:50 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:50 UTC] Array
(
    [page] => 1512
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:50 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:51 UTC] Array
(
    [page] => 1511
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:51 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:52 UTC] Array
(
    [page] => 1510
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:52 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:53 UTC] Array
(
    [page] => 1509
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:53 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 14:59:53 UTC] Array
(
    [page] => 1508
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 14:59:54 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

Pages up to 999 work:

[11-Jul-2024 15:02:14 UTC] Array
(
    [page] => 997
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 15:02:15 UTC] Array
(
    [page] => 997
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 15:02:19 UTC] Array
(
    [page] => 998
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 15:02:19 UTC] Array
(
    [page] => 998
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 15:02:20 UTC] Array
(
    [page] => 999
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 15:02:20 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)

[11-Jul-2024 15:02:21 UTC] Array
(
    [page] => 1000
    [per_page] => 36
    [locale] => en_US
    [browse] => popular
)

[11-Jul-2024 15:02:21 UTC] Array
(
    [page] => 999
    [pages] => 1519
    [results] => 54669
)
Note: See TracTickets for help on using tickets.