[wp-trac] [WordPress Trac] #47719: Consistency issue with `include` parameter set to "0" in `WP_Term_Query`
WordPress Trac
noreply at wordpress.org
Sun Nov 1 16:48:51 UTC 2020
#47719: Consistency issue with `include` parameter set to "0" in `WP_Term_Query`
-------------------------------------------------+-------------------------
Reporter: audrasjb | Owner:
| SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 5.6
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):
* keywords: has-patch has-unit-tests commit => has-patch has-unit-tests
dev-feedback
Comment:
When applying the patch, the `$terms` property's value and data type
changes: was `array`, now `null`. This will be a breaking change,
especially when using the `terms` property in an iterator, such as
`foreach`.
When no terms are found, [https://github.com/WordPress/wordpress-
develop/pull/679/commits/25aaa5dd81a9cea10e1457d4bef3f6716486aa1c this
commit] changes the `terms` property to an empty array before bailing out.
{{{#!php
<?php
if ( empty( $terms ) ) {
wp_cache_add( $cache_key, array(), 'terms',
DAY_IN_SECONDS );
$this->terms = array();
return $this->terms;
}
}}}
@audrasjb @SergeyBiryukov What do you foresee any side effects or impacts
from this change?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47719#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list