Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 01ddf68

Browse files
committed
apply RuntimException in setCharset() when isValid() = false
1 parent 6b6690d commit 01ddf68

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Helper/HeadMeta.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ protected function normalizeType($type)
323323
* Determine if item is valid
324324
*
325325
* @param mixed $item
326-
* @throws Exception\RuntimeException
327326
* @return bool
328327
*/
329328
protected function isValid($item)
@@ -337,7 +336,7 @@ protected function isValid($item)
337336

338337
$doctype = $this->view->plugin('doctype');
339338
if ($item->type === 'charset' && $doctype->isXhtml()) {
340-
throw new Exception\RuntimeException('XHTML* doctype has no attribute charset; please use appendHttpEquiv()');
339+
return false;
341340
}
342341

343342
if (! isset($item->content)
@@ -474,7 +473,11 @@ public function setCharset($charset)
474473
$item->charset = $charset;
475474
$item->content = null;
476475
$item->modifiers = [];
477-
$this->isValid($item);
476+
477+
if (! $this->isValid($item)) {
478+
throw new Exception\RuntimeException('XHTML* doctype has no attribute charset; please use appendHttpEquiv()');
479+
}
480+
478481
$this->set($item);
479482

480483
return $this;

0 commit comments

Comments
 (0)