Make WordPress Core


Ignore:
Timestamp:
02/04/2026 06:51:51 PM (4 months ago)
Author:
westonruter
Message:

Formatting: Deprecate the addslashes_gpc() function.

This deprecates addslashes_gpc() in favor of wp_slash(), as the former is just a wrapper for the latter. The three remaining uses of addslashes_gpc() (in WP_Query) have been replaced with wp_slash(). Unit tests are added to verify that they have the same behavior.

Developed in https://github.com/WordPress/wordpress-develop/pull/10771

Follow-up to [23591], [23555].

Props rutviksavsani, audrasjb, westonruter, mindctrl, johnbillion.
See #21767.
Fixes #64539.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r61518 r61590  
    64826482
    64836483/**
     6484 * Adds slashes to a string or recursively adds slashes to strings within an array.
     6485 *
     6486 * This function is just a wrapper for `wp_slash()`. It was originally related to
     6487 * magic quotes functionality which was deprecated in PHP 5.3.0 and removed in PHP 5.4.0.
     6488 *
     6489 * @since 0.71
     6490 * @deprecated 7.0.0 Use wp_slash() instead.
     6491 * @see wp_slash()
     6492 *
     6493 * @param string|array $gpc String or array of data to slash.
     6494 * @return string|array Slashed `$gpc`.
     6495 */
     6496function addslashes_gpc( $gpc ) {
     6497    _deprecated_function( __FUNCTION__, '7.0.0', 'wp_slash()' );
     6498    return wp_slash( $gpc );
     6499}
     6500
     6501/**
    64846502 * Sanitizes an attributes array into an attributes string to be placed inside a `<script>` tag.
    64856503 *
     
    65096527    return $attributes_string;
    65106528}
    6511 
Note: See TracChangeset for help on using the changeset viewer.