[wp-trac] [WordPress Trac] #50639: [PHP 8] Add @requires annotations for PHPUnit tests that assert engine-enforced constraints

WordPress Trac noreply at wordpress.org
Sun Sep 13 14:39:51 UTC 2020


#50639: [PHP 8] Add @requires annotations for PHPUnit tests that assert engine-
enforced constraints
------------------------------------------+-----------------------------
 Reporter:  ayeshrajans                   |       Owner:  SergeyBiryukov
     Type:  defect (bug)                  |      Status:  reviewing
 Priority:  normal                        |   Milestone:  5.6
Component:  Build/Test Tools              |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  php8 has-patch needs-refresh  |     Focuses:
------------------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Looks like the `wpdb` part of [attachment:"50639-1.patch"] was committed
 separately in [48973] / #50913.

 Per comment:3, that appears to be not a good idea:
 > The tests are verifying that a "doing it wrong" notice is being thrown
 when the function is called incorrectly, but that the function will still
 handle the provided input as correctly as possible.
 >
 > Disabling those 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.
 >
 > This is a backward-compatibility break and WP will either need to put
 code in place to maintain the original behaviour of the function or
 document that the behaviour in certain circumstances is different on PHP
 8.

 So I guess [48973] should be reverted for now, and we should look into
 preserving the current behavior: a `_doing_it_wrong()` notice on PHP 8,
 rather than a fatal error.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50639#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list