Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F41649906
log_of_commit_to_parser.txt
dominic.mayers
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
dominic.mayers
Jan 3 2024, 10:12 PM
2024-01-03 22:12:18 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
log_of_commit_to_parser.txt
View Options
commit bd5ea6b1b3745d807d6ded9261ba49df1c292e55
Author: Dominic Mayers <dominic.mayers@meditationstudies.org>
Date: Wed Jan 3 15:43:41 2024 -0500
parser: Find the closing tag with a balanced inner text
The current code for the parser fails when the code contains
two levels of nesting with an empty ref tag. For example,
it fails on <ref>A<ref>B<ref name="N" /></ref></ref>. You
will not see it on a real page, because it will be hidden
behind other problems. But with the series of patches that
I am offering for the Cite extension, these other problems
disappear and then this limitation can be seen. The faulted
code is this pregmatch in Preprocessor_Hash.php :
preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i",
$text, $matches, PREG_OFFSET_CAPTURE, $offset ) )
It expects the $offset to be the start of the inner text.
In the above example, the $offset will be 5. The code
computes the inner text with the expression
$inner = substr( $text, $offset, $matches[0][1] - $offset );
In the above example, the returned $inner is
A<ref>B<ref name="N" />. The correct value is
A<ref>B<ref name="N" /></ref>. The commit defines
a function pregFindClosingTag() to replace the
faulty preg_match.
Bug: T22707
Change-Id: I5e6c17f553623d4f80a8f73b527fb4b9a7dbb421
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14450646
Default Alt Text
log_of_commit_to_parser.txt (1 KB)
Attached To
Mode
T22707: Nested refs fail inside references block
Attached
Detach File
Event Timeline
Log In to Comment