From b88f9ca881c5cb7aefea75431b93d1f0e1030077 Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Tue, 24 Nov 2020 10:54:23 -0500 Subject: [PATCH] Fix porting bug from 005176a Bug: T249742 Change-Id: Iabe86266c06b2cbc3c51b16b73d360a7182878f1 --- src/Parsoid/Ref.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Parsoid/Ref.php b/src/Parsoid/Ref.php index 047398db9..08760d196 100644 --- a/src/Parsoid/Ref.php +++ b/src/Parsoid/Ref.php @@ -118,8 +118,8 @@ class Ref extends ExtensionTagHandler { if ( !$bodyElt ) { $extraDebug = ''; $firstA = DOMCompat::querySelector( $node, 'a[href]' ); - $href = $firstA->getAttribute( 'href' ); - if ( $firstA && preg_match( '/^#/', $href ) ) { + if ( $firstA && preg_match( '/^#/', $firstA->getAttribute( 'href' ) ) ) { + $href = $firstA->getAttribute( 'href' ); try { $ref = DOMCompat::querySelector( $extApi->getTopLevelDoc(), $href ); if ( $ref ) { @@ -129,7 +129,6 @@ class Ref extends ExtensionTagHandler { // We are just providing VE with debugging info. // So, ignore all exceptions / errors in this code. } - if ( !$extraDebug ) { $extraDebug = ' [reference ' . $href . ' not found]'; }