Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#57762 closed defect (bug) (fixed)

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

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

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 4 years ago.
Fixed the warning error

Download all attachments as: .zip

Change History (4)

@chiragrathod103
4 years ago

Fixed the warning error

#1 @chiragrathod103
4 years ago

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

#2 @SergeyBiryukov
4 years ago

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

#3 @SergeyBiryukov
4 years ago

  • Resolution → fixed
  • Status reviewing → 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.