diff --git a/src/IndieWeb/link_rel_parser.php b/src/IndieWeb/link_rel_parser.php index 6aa73f2..ff6446c 100644 --- a/src/IndieWeb/link_rel_parser.php +++ b/src/IndieWeb/link_rel_parser.php @@ -33,7 +33,7 @@ function http_rels($h) { foreach ($relarray as $rel) { $rel = strtolower(trim($rel)); if ($rel != '') { - if (!$rels[$rel]) { + if (!array_key_exists($rel, $rels)) { $rels[$rel] = array(); } if (!in_array($href, $rels[$rel])) { diff --git a/tests/BasicTest.php b/tests/BasicTest.php index 70ae8f6..f92d658 100644 --- a/tests/BasicTest.php +++ b/tests/BasicTest.php @@ -11,35 +11,28 @@ private function _testEquals($expected, $headers) { public function testExample() { $this->_testEquals(array( - 'rels' => array( - 'd' => array('http://example.org/query?a=b,c'), - 'e' => array('http://example.org/query?a=b,c'), - 'f' => array('http://example.org/'), - ) + 'd' => array('http://example.org/query?a=b,c'), + 'e' => array('http://example.org/query?a=b,c'), + 'f' => array('http://example.org/'), ), "Link: ; rel=\"d e\", ; rel=f"); } public function testMultipleAttributes() { $this->_testEquals(array( - 'rels' => array( - 'foo' => array('http://example.org/'), - ) + 'foo' => array('http://example.org/'), ), "Link: ; rel=\"foo\"; title=\"Example\""); } public function testLinkNoRelValue() { $this->_testEquals(array( - 'rels' => array( - ) ), "Link: ; title=\"Example\""); } public function testAaronParecki() { $this->_testEquals(array( - 'rels' => array( - 'http://webmention.org/' => array('http://aaronparecki.com/webmention.php'), - 'indieauth' => array('https://indieauth.com'), - ) + 'http://webmention.org/' => array('http://aaronparecki.com/webmention.php'), + 'indieauth' => array('https://indieauth.com'), + 'pingback' => array('http://pingback.me/webmention?forward=http%3A%2F%2Faaronparecki.com%2Fwebmention.php') ), "HTTP/1.1 200 OK Server: nginx/1.0.14 Date: Sat, 26 Oct 2013 01:40:11 GMT @@ -52,9 +45,7 @@ public function testAaronParecki() { public function testBarryFrost() { $this->_testEquals(array( - 'rels' => array( - 'webmention' => array('http://barryfrost.com/webmention'), - ) + 'webmention' => array('http://barryfrost.com/webmention'), ), "HTTP/1.1 200 OK Cache-Control: max-age=0, private, must-revalidate Content-length: 19600