Make WordPress Core


Ignore:
Timestamp:
09/16/2020 01:33:42 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Revert [48973].

These tests ensure that a _doing_it_wrong() notice is thrown when wpdb::prepare() is called incorrectly, but also that the function will still handle the provided input as correctly as possible.

Disabling these tests on PHP 8 hides a problem, i.e. the function will no longer throw a notice and handle things correctly, it will now cause a white screen of death due to a fatal error.

That is a backward compatibility break, and wpdb::prepare() should be updated instead to maintain the original behaviour on PHP 8.

Props jrf, ayeshrajans.
See #50913, #50639.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/db.php

    r48974 r48979  
    380380    /**
    381381     * @expectedIncorrectUsage wpdb::prepare
    382      * @requires PHP < 8.0
    383382     */
    384383    function test_prepare_sprintf_invalid_args() {
     
    403402    /**
    404403     * @expectedIncorrectUsage wpdb::prepare
    405      * @requires PHP < 8.0
    406404     */
    407405    function test_prepare_vsprintf_invalid_args() {
     
    421419     * @dataProvider data_prepare_incorrect_arg_count
    422420     * @expectedIncorrectUsage wpdb::prepare
    423      * @requires PHP < 8.0
    424421     */
    425422    public function test_prepare_incorrect_arg_count( $query, $args, $expected ) {
Note: See TracChangeset for help on using the changeset viewer.