diff --git a/lib/Formats/Mf2.php b/lib/Formats/Mf2.php index bc41705..c786ffa 100644 --- a/lib/Formats/Mf2.php +++ b/lib/Formats/Mf2.php @@ -110,7 +110,7 @@ class Mf2 { // Single plaintext values $properties = ['url','published','summary','rsvp']; foreach($properties as $p) { - if($v = self::getPlaintext($item, $p)) { + if(($v = self::getPlaintext($item, $p)) !== null) { if($p == 'url') { if(self::isURL($v)) $data[$p] = $v; @@ -235,7 +235,7 @@ class Mf2 { // Single plaintext values $properties = ['name','summary','url','published','start','end','duration']; foreach($properties as $p) { - if($v = self::getPlaintext($item, $p)) { + if(($v = self::getPlaintext($item, $p)) !== null) { if($p == 'url') { if(self::isURL($v)) $data[$p] = $v; @@ -363,7 +363,7 @@ class Mf2 { if(!$found && self::isURL($item['properties']['url'][0])) { $data['url'] = $item['properties']['url'][0]; } - } else if($v = self::getPlaintext($item, $p)) { + } else if(($v = self::getPlaintext($item, $p)) !== null) { // Make sure the URL property is actually a URL if($p == 'url' || $p == 'photo') { if(self::isURL($v)) diff --git a/tests/AuthorTest.php b/tests/AuthorTest.php index 5f5a20b..120e660 100644 --- a/tests/AuthorTest.php +++ b/tests/AuthorTest.php @@ -138,6 +138,19 @@ class AuthorTest extends PHPUnit_Framework_TestCase { $this->assertEquals('http://author.example.com/photo.jpg', $data->data->photo); } + public function testHEntryAuthorIs0() { + $url = 'http://author.example.com/author-name-is-0'; + $response = $this->parse(['url' => $url]); + + $body = $response->getContent(); + $this->assertEquals(200, $response->getStatusCode()); + $data = json_decode($body); + + $this->assertEquals('card', $data->data->type); + $this->assertEquals('http://author.example.com/photo.jpg', $data->data->photo); + $this->assertEquals('0', $data->data->name); + } + /* public function testHFeedHasHCardAuthor() { $url = 'http://author.example.com/h-feed-has-h-card-author'; diff --git a/tests/data/author.example.com/author-name-is-0 b/tests/data/author.example.com/author-name-is-0 new file mode 100644 index 0000000..c500fde --- /dev/null +++ b/tests/data/author.example.com/author-name-is-0 @@ -0,0 +1,22 @@ +HTTP/1.1 200 OK +Server: Apache +Date: Wed, 09 Dec 2015 03:29:14 GMT +Content-Type: text/html; charset=utf-8 + + + +
+ +