Changeset 31157
- Timestamp:
- 01/12/2015 02:23:43 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r31155 r31157 34 34 * 35 35 * @param int $blog_id Blog ID 36 * @return string 36 * @return string Full URL of the blog if found. Empty string if not. 37 37 */ 38 38 function get_blogaddress_by_id( $blog_id ) { 39 39 $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! 40 return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );40 return isset( $bloginfo->domain ) && isset( $bloginfo->path ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : ''; 41 41 } 42 42 -
trunk/tests/phpunit/tests/multisite/site.php
r31155 r31157 333 333 $this->assertFalse( $result ); 334 334 } 335 335 336 336 function test_update_blog_details() { 337 337 $blog_id = $this->factory->blog->create(); … … 1462 1462 remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 ); 1463 1463 } 1464 1465 /** 1466 * Tests returning an address for a given valid id. 1467 */ 1468 function test_get_blogaddress_by_id_with_valid_id() { 1469 $blogaddress = get_blogaddress_by_id( 1 ); 1470 $this->assertEquals( 'http://example.org/', $blogaddress ); 1471 } 1472 1473 /** 1474 * Tests returning the appropriate response for a invalid id given. 1475 */ 1476 function test_get_blogaddress_by_id_with_invalid_id() { 1477 $blogaddress = get_blogaddress_by_id( 42 ); 1478 $this->assertEquals( '', $blogaddress ); 1479 } 1464 1480 } 1465 1481
Note: See TracChangeset
for help on using the changeset viewer.