From 3c360968ef59251bc809b545ff3c4e17ae6a64b1 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Mon, 10 Nov 2014 02:04:22 +0000 Subject: [PATCH] Fix PHP notice in `Tests_Feed_RSS2::test_items()`. A notice was being thrown when `get_the_tags()` returned false, and `foreach()` was run over that return value. See [30283]. git-svn-id: https://develop.svn.wordpress.org/trunk@30295 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/feed/rss2.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/feed/rss2.php b/tests/phpunit/tests/feed/rss2.php index ffac654160..cc82556121 100644 --- a/tests/phpunit/tests/feed/rss2.php +++ b/tests/phpunit/tests/feed/rss2.php @@ -125,8 +125,12 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase { foreach ( get_the_category( $post->ID ) as $term ) { $cats[] = $term->name; } - foreach ( get_the_tags( $post->ID ) as $term ) { - $cats[] = $term->name; + + $tags = get_the_tags( $post->ID ); + if ( $tags ) { + foreach ( get_the_tags( $post->ID ) as $term ) { + $cats[] = $term->name; + } } $cats = array_filter( $cats ); // should be the same number of categories