This repository was archived by the owner on Jan 31, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -458,10 +458,15 @@ public function set($value)
458
458
* Not valid in a non-HTML5 doctype
459
459
*
460
460
* @param string $charset
461
+ * @throws Exception\RuntimeException
461
462
* @return HeadMeta Provides a fluent interface
462
463
*/
463
464
public function setCharset ($ charset )
464
465
{
466
+ if ($ this ->view ->plugin ('doctype ' )->isXhtml ()) {
467
+ throw new Exception \RuntimeException ('XHTML* doctype has no attribute charset ' );
468
+ }
469
+
465
470
$ item = new stdClass ;
466
471
$ item ->type = 'charset ' ;
467
472
$ item ->charset = $ charset ;
Original file line number Diff line number Diff line change @@ -440,6 +440,18 @@ public function testCharsetPosition()
440
440
);
441
441
}
442
442
443
+ public function testCarsetWithXhtmlDoctypeGotException ()
444
+ {
445
+ $ this ->expectException (Exception \RuntimeException::class);
446
+ $ this ->expectExceptionMessage ('XHTML* doctype has no attribute charset ' );
447
+
448
+ $ view = new View ();
449
+ $ view ->plugin ('doctype ' )->__invoke ('XHTML1_RDFA ' );
450
+
451
+ $ view ->plugin ('headMeta ' )
452
+ ->setCharset ('utf-8 ' );
453
+ }
454
+
443
455
/**
444
456
* @group ZF-9743
445
457
*/
You can’t perform that action at this time.
0 commit comments