Last modified: 2013-01-02 16:31:26 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45584, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43584 - action=parse doesn't return proper byteoffsets for sections
action=parse doesn't return proper byteoffsets for sections
Status: RESOLVED DUPLICATE of bug 25203
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.21.x
All All
: Unprioritized major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-02 11:41 UTC by Dmytro Dziuma
Modified: 2013-01-02 16:31 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dmytro Dziuma 2013-01-02 11:41:53 UTC
If there is <h2> tag on the page, action=parse doesn't return proper byte offsets for sections

Look here, for example:
http://uk.wikipedia.org/w/api.php?action=parse&prop=sections&oldid=11303632

And corresponding page for parsing is http://uk.wikipedia.org/w/index.php?oldid=11303632
Comment 1 Brad Jorsch 2013-01-02 15:26:36 UTC
Odd that "byteoffset" is actually the offset in Unicode codepoints.

The problem is actually in includes/parser/Parser.php, method formatHeadings(). It pulls out all the <h#> tags from the parsed HTML, but uses the parsed-to-DOM representation of the original wikitext to try to calculate the byteoffset. This parsed-to-DOM representation, however, doesn't include DOM structure for any raw <h#> tags from the original wikitext, so when it tries to find the DOM node for one of those it searches to the end of the wikitext without finding it. Which also screws up all subsequent headers.

Roan, it looks like you added this back in 2009, any ideas here? Otherwise I'll just put together a patch that skips trying to calculate byteoffset when $sectionIndex === false.
Comment 2 Umherirrender 2013-01-02 16:26:38 UTC
related: bug 25203
Comment 3 Brad Jorsch 2013-01-02 16:31:26 UTC
Not just related, it's a duplicate.

*** This bug has been marked as a duplicate of bug 25203 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links