diff --git a/src/Parsoid/References.php b/src/Parsoid/References.php index 01e6c0b75..010723b0b 100644 --- a/src/Parsoid/References.php +++ b/src/Parsoid/References.php @@ -150,6 +150,7 @@ class References extends ExtensionTagHandler { // to TokenUtils::kvToHash() and ExtensionHandler::normalizeExtOptions() $refName = $refDmw->attrs->name ?? ''; $followName = $refDmw->attrs->follow ?? ''; + $refDir = strtolower( $refDmw->attrs->dir ?? '' ); // Looks like Cite.php doesn't try to fix ids that already have // a "_" in them. Ex: name="a b" and name="a_b" are considered @@ -216,6 +217,10 @@ class References extends ExtensionTagHandler { ); } + if ( isset( $refDmw->attrs->dir ) && $refDir !== 'rtl' && $refDir !== 'ltr' ) { + $errs[] = [ 'key' => 'cite_error_ref_invalid_dir' ]; + } + // Check for missing content, added ?? '' to fix T259676 crasher // FIXME: See T260082 for a more complete description of cause and deeper fix $missingContent = ( !empty( $cDp->empty ) || trim( $refDmw->body->extsrc ?? '' ) === '' ); @@ -333,7 +338,7 @@ class References extends ExtensionTagHandler { // Keep the first content to compare multiple s with the same name. if ( $ref->contentId === null && !$missingContent ) { $ref->contentId = $contentId; - $ref->dir = strtolower( $refDmw->attrs->dir ?? '' ); + $ref->dir = $refDir; } else { DOMCompat::remove( $c ); $extApi->clearContentDOM( $contentId );