Make WordPress Core


Ignore:
Timestamp:
01/17/2021 04:36:14 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Correct description for wp_slash() and wp_unslash().

The array received or returned by these functions is not always an array of strings, for example when slashing or unslashing an array of arrays.

Follow-up to [47400], [48441], [49926].

Props johnbillion.
See #51800.

File:
1 edited

Legend:

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

    r49967 r49968  
    55165516
    55175517/**
    5518  * Add slashes to a string or array of strings, in a recursive manner.
     5518 * Adds slashes to a string or recursively adds slashes to strings within an array.
    55195519 *
    55205520 * This should be used when preparing data for core API that expects slashed data.
     
    55245524 * @since 5.5.0 Non-string values are left untouched.
    55255525 *
    5526  * @param string|string[] $value String or array of strings to slash.
    5527  * @return string|string[] Slashed $value.
     5526 * @param string|array $value String or array of data to slash.
     5527 * @return string|array Slashed $value.
    55285528 */
    55295529function wp_slash( $value ) {
     
    55405540
    55415541/**
    5542  * Remove slashes from a string or array of strings.
     5542 * Removes slashes from a string or recursively removes slashes from strings within an array.
    55435543 *
    55445544 * This should be used to remove slashes from data passed to core API that
     
    55475547 * @since 3.6.0
    55485548 *
    5549  * @param string|array $value String or array of strings to unslash.
    5550  * @return string|array Unslashed $value
     5549 * @param string|array $value String or array of data to unslash.
     5550 * @return string|array Unslashed $value.
    55515551 */
    55525552function wp_unslash( $value ) {
Note: See TracChangeset for help on using the changeset viewer.