Make WordPress Core

#57762 closed defect (bug) (fixed)

repair.php gives Deprecated: addcslashes() warning PHP8.2

Reported by: ipajen's profile ipajen Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.2 Priority: normal
Severity: normal Version: 6.2
Component: Administration Keywords: php81 has-patch
Focuses: administration, coding-standards Cc:

Description

6.2-beta2-55354, PHP 8.2.0

  1. Enable Debug
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
  1. Enable following in wp-config.php
    define('WP_ALLOW_REPAIR', true);
    
  2. Run http://localhost/wp/wp-admin/maint/repair.php
  3. Run Repair Database or Repair and Optimize Database

Following Deprecated warning is given

Deprecated: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in C:\xampp\htdocs\wp\wp-includes\class-wpdb.php on line 1804

Attachments (1)

57762.diff (840 bytes) - added by chiragrathod103 17 months ago.
Fixed the warning error

Download all attachments as: .zip

Change History (4)

@chiragrathod103
17 months ago

Fixed the warning error

#1 @chiragrathod103
17 months ago

  • Focuses administration coding-standards added
  • Keywords has-patch added

#2 @SergeyBiryukov
17 months ago

  • Keywords php81 added; PHP82 removed
  • Milestone changed from Awaiting Review to 6.2
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @SergeyBiryukov
17 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55421:

Database: Remove the check for sitecategories table on Database Repair screen.

The table is no longer created by core as of WordPress 3.0, and support for global terms was removed in WordPress 6.1, so $wpdb->sitecategories is unset by default.

This commit resolves a "passing null to non-nullable" deprecation notice on PHP 8.1:

Deprecated: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in wp-includes/class-wpdb.php on line 1804

The tables_to_repair filter is available for plugins to readd the table or include any additional tables to repair.

Follow-up to [14854], [14880], [54240].

Props ipajen, chiragrathod103, SergeyBiryukov.
Fixes #57762.

Note: See TracTickets for help on using tickets.