Make WordPress Core


Ignore:
Timestamp:
02/07/2019 11:34:22 PM (7 years ago)
Author:
pento
Message:

Formatting: Loosen the type checking in _sanitize_text_fields().

[44618] added strict type checking to _sanitize_text_fields(), which has caused some compat issues with plugins.

We can loosen the type checking to only reject objects and arrays, and cast other types to string.

Props Nick_theGeek, pento.
Fixes #41450.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/SanitizeTextField.php

    r44618 r44731  
    9898                '',
    9999            ),
     100            array(
     101                array( 1, 2, 'foo' ),
     102                '',
     103            ),
     104            array(
     105                new WP_Query,
     106                '',
     107            ),
     108            array(
     109                2,
     110                '2',
     111            ),
     112            array(
     113                false,
     114                '',
     115            ),
     116            array(
     117                true,
     118                '1',
     119            ),
     120            array(
     121                10.1,
     122                '10.1',
     123            ),
    100124        );
    101125    }
Note: See TracChangeset for help on using the changeset viewer.