Commit graph

1367 commits

Author SHA1 Message Date
Amir Sarabadani
523ab7cff8 Reorg: Move RawMessage to under language/
To follow Message. This is approved as part of RFC T166010.

Also namespace it but doing it properly with PSR-4 would require
namespacing every class under language/ and that will take some time.

Bug: T321882
Change-Id: I195cf4c67bd51410556c2dd1e33cc9c1033d5d18
2022-12-16 11:30:19 +01:00
jenkins-bot
b8f0f51e42 Merge "Parser: Allow dynamic properties on PHP 8.2" 2022-12-12 04:35:28 +00:00
Reedy
11631f5fce Parser: Allow dynamic properties on PHP 8.2
Bug: T324890
Bug: T324891
Bug: T324901
Change-Id: I72ec23f81820ce8347f576791d00d8c812544494
2022-12-10 21:43:59 +00:00
Amir Sarabadani
a1b4699fea Reorg: Move MagicWord related files to under parser/
This is approved as part of T166010 RFC.

Bug: T321882
Change-Id: Ia4498c0a20e38a6a288dc14065ea8242c84fbc49
2022-12-09 13:48:35 +01:00
Amir Sarabadani
2d60ba0c63 Reorg: Move DummyLinker and Linker to linker/
This feels like a no-brainer unless I'm missing something obvious

Bug: T321882
Change-Id: Id49c3d0dd6ea4593211048850856b5b8e05a8fb3
2022-12-08 06:38:17 +01:00
jenkins-bot
eac1ff55df Merge "Parser: Minor code style and comment improvements" 2022-12-02 20:55:55 +00:00
Amir Sarabadani
02e5a33057 Drop more unused hard deprecated hooks
None are used in WMF-deployed extensions and have been hard deprecated
for multiple releases as well.

Change-Id: I62cfa22291f81295b4908192de8657a750c6716d
2022-12-01 03:36:48 +01:00
Amir Sarabadani
20c5632c4e Drop unused deprecated hooks
Part one, none of these hooks are used in extensions deployed in
production. I skipped any hook that has silenced its deprecation
warnings.

Change-Id: Idf1fd12cc61ca30867dc9f8aeb1701fe035fc5ff
2022-11-28 13:15:19 +00:00
Máté Szabó
b523ab0081 Parser: Fix extractSections() behavior for PHP >= 8.0
PHP 8.0 changed the behavior of numeric comparisons such that
non-numeric strings no longer weakly equal 0.[1] This breaks the logic
in Parser::extractSections(), which was relying on the old comparison
behavior for section indexes and in turn causes the revisions API to
return a bogus 'nosuchsection' for error when called with rvsection=new.

Fix the logic by explicitly casting the section index to a number, which
will yield the appropriate numeric section index for a numbered section
index and 0 for a non-numeric section index (like 'new'). Also add test
cases for the relevant API module.
--
[1] https://wiki.php.net/rfc/string_to_number_comparison

Change-Id: If32aa4d575cff66bd4eee56f9e3b0b0d9ba04fde
Bug: T323373
2022-11-18 15:23:46 +01:00
C. Scott Ananian
24d69ef952 Deprecate Parser::getFunctionLang()
This is identical to Parser::getTargetLanguage() in modern MediaWiki,
since 7df3473cfe in MW 1.19 (2012).

Bug: T318860
Depends-On: If5fa696e27e84a3aa1343551d7482c933da0a9b6
Depends-On: I87a7ceedce173f6de4bb6722ffe594273c7b0359
Change-Id: Ieed03003095656e69b8e64ed307c6bd67c45c1e7
2022-11-16 16:47:16 -05:00
jenkins-bot
5b0fb2f8b2 Merge "Parser: Fix quadratic regexp edge case" 2022-11-10 00:02:43 +00:00
Bartosz Dziewoński
0b96615ecc Tweak misleading error message about PCRE
Many things can cause the failure here, it's most likely not the
lack of support for Unicode properties (which we also check for
in Installer::envCheckPCRE()).

Bug: T321467
Change-Id: I65b7f302c4c6708e0a0c056cfd722f0ef24bd09e
2022-11-09 10:47:53 -06:00
Bartosz Dziewoński
9f720c8bce Parser: Fix quadratic regexp edge case
In external link syntax like `[http://example.org Example]`,
the space between link target and label is technically optional
when the label starts with characters not allowed in the URL,
such as `[http://example.org<b>Example</b>]`.

This is done with a regexp that matches a required opening bracket,
a required URL, optional spaces, optional label, and a required
closing bracket. The real regexp is messy to handle various characters
allowed in each part, but for illustration purposes, it's basically
the same as `\[([^\]\s\<]+) *([^\]\s]*?)\]`.

When given input that looks like a link, but doesn't have the closing
bracket, the regexp engine (PCRE) would therefore attempt matching
every possible combination of target and label lengths before failing:

Input:   [http://example.org

| Target             | Label |
| ------------------ | ----- |
| http://example.or  | g     |
| http://example.o   | r     |
| http://example.o   | rg    |
| http://example.    | o     |
| http://example.    | or    |
| http://example.    | org   |
| http://example     | .     |
| http://example     | .o    |
| http://example     | .or   |
| http://example     | .org  |
| http://exampl      | e     |
| http://exampl      | e.    |
| http://exampl      | e.o   |
| http://exampl      | e.or  |
| http://exampl      | e.org |

…and so on. This would take (1 + 2 + 3 + … + 18) = 171 steps to fail
in this example, or `N * (N+1) / 2` steps in general. For sufficiently
large inputs this hits a limit designed to protect against exactly
this situation, and the whole wikitext parser crashes.

(To hit the pathological case, it's also required for a `]` to appear
somewhere later in the input, otherwise PCRE would detect that a match
is never possible and exit before doing any of the above.)

Live example: https://regex101.com/debugger/?regex=%5C%5B%28%5B%5E%5C%5D%5Cs%5C%3C%5D%2B%29%20%2A%28%5B%5E%5C%5D%5Cs%5D%2A%3F%29%5C%5D&testString=%5Bhttp%3A%2F%2Fexample.org%0A%5D

We can fix it by changing the lazy quantifier `*?` to the greedy `*`.
This is correct for this regexp only because the label isn't allowed
to contain ']' (otherwise, the first external link on the page would
consume all of the content until the last external link as its label).

This allows PCRE to only consider the cases where the label has the
maximum possible length:

| Target             | Label |
| ------------------ | ----- |
| http://example.or  | g     |
| http://example.o   | rg    |
| http://example.    | org   |
| http://example     | .org  |
| http://exampl      | e.org |

…and so on. Only 18 steps, or `N` steps in general.

Live example: https://regex101.com/debugger/?regex=%5C%5B%28%5B%5E%5C%5D%5Cs%5C%3C%5D%2B%29%20%2A%28%5B%5E%5C%5D%5Cs%5D%2A%29%5C%5D&testString=%5Bhttp%3A%2F%2Fexample.org%0A%5D

I think this bug has been present since 2004, when external link
parsing was rewritten in badf11ffe6 (SVN r4579).

Bug: T321467
Change-Id: I993a10d9a90ab28cce61eba6beabee8a06a2d562
2022-11-09 17:09:24 +01:00
Tim Starling
e1041b4d7a Fix the remaining Phan failures on PHP 8.1
* Use @phan-var to suppress issues with version independence.
* In Parser strictly compare to false. I still think this is a Phan bug.

Bug: T322278
Change-Id: I654b73e5ed843474ed35c3780d95b04dce388bea
2022-11-09 13:12:50 +11:00
Umherirrender
1b342a8893 Various doc fixes about false and null on method arguments/return types
Doc-only changes

Change-Id: Ice974b3ba41708859dfe646e94b31c5ebbf26410
2022-11-03 18:55:47 +01:00
Amir Sarabadani
bbe704b5c1 Reorg: Move some of request related classes to MediaWiki/Request
Redoing I5ea70120d74 but without moving WebRequest that caused issues
with phan-taint-plugin.

Moving:
 - DerivativeRequest
 - FauxRequest
 - FauxRequestUpload
 - PathRouter
 - WebRequestUpload

Bug: T321882
Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
2022-10-28 10:15:31 +00:00
Zabe
f6b9381d7f Revert "Reorg: Move some of request related classes to MediaWiki/Request"
This reverts commit 2bdc0b2b72.

Reason for revert: T166010#8349431

Bug: T166010
Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
2022-10-27 13:14:16 +00:00
Amir Sarabadani
2bdc0b2b72 Reorg: Move some of request related classes to MediaWiki/Request
Moving:
 - DerivativeRequest
 - FauxRequest
 - FauxRequestUpload
 - PathRouter
 - WebRequest
 - WebRequestUpload

Bug: T166010
Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
2022-10-26 16:49:10 +02:00
Amir Sarabadani
0fff5089ba Reorg: Move StubObject classes in includes to its own directory
Bug: T166010
Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
2022-10-25 16:04:48 -04:00
jenkins-bot
43830cde86 Merge "Use array_key_first()/array_key_last() in some places" 2022-10-21 21:57:34 +00:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Tim Starling
1aeccebaf2 Use array_key_first()/array_key_last() in some places
Introduced in PHP 7.3. I used it to replace reset()/end() followed by
key() where the return value of reset() is not captured and internal
pointer iteration is not locally occuring.

I also used it in a couple of places when reset() is absent but
array_key_first() is semantically desired.

Change-Id: I750d3fa71420cbdca5fb00d82ac5ca40821769d4
2022-10-21 15:01:59 +11:00
Timo Tijhof
06245f3f4f SpecialVersion: Clean up count(), early return, strict types
* Remove some use of `count()` in favour of boolean checks.

* Where trivial to do, add native return types to remove doubt
  of the value possibly not being an array.

* Follow-up I7d97a4cdc9 (d4df7daa) and mark more methods as private
  that were wrongly marked public en-mass when we added visibility
  attributes but have no use outside core on a SpecialPage class that
  generally has no use case for being extended or instantiated
  outside core.

Change-Id: Iaf28b6132097fe34872c2a2da374ff00593ca6a9
2022-10-13 19:21:13 +01:00
Bartosz Dziewoński
5f9b3ae29f Parser: Minor code style and comment improvements
* Use str_starts_with where appropriate
* Avoid confusing reuse of variable names
* Add comments explaining why we handle tag attributes in a funny way
* Improve documentation comments

Change-Id: I09f32b6922f319425c33697779a2d14f79678ce1
2022-10-08 16:51:08 +02:00
Daimona Eaytoy
947ff7c0f5 build: Update mediawiki/mediawiki-phan-config to 0.12.0
This patch only adds and removes suppressions, which must be done in the
same patch as the version bump.

Bug: T298571
Change-Id: I4044d4d9ce82b3dae7ba0af85bf04f22cb1dd347
2022-10-08 15:45:42 +02:00
Brian Wolff
f27945728f In the event of preg failure in MagicWordArray throw exception
Previously we just logged this. If this happens, it replaces the
entire page with null, which I think is exception worthy and
very confusing if it happens.

The most likely cause of this error would be if the input
text had invalid UTF-8 in it.

I checked logstash, and this warning did not appear in the logs
in the last 90 days.

See also bug T319218

Change-Id: Ic0c9083bd8c524ddce9c7d9d10629daa8f6b8999
2022-10-05 10:16:16 -07:00
Brian Wolff
ea6eaf7db6 Ensure Parser::fetchFileAndTitle returns title after img redirects
This is a regression from 4880a82555. Previously this function
returned the resulting Title after resolving all redirects.

The difference is subtle, mostly around what title attribute to
use for Media: links, and what alt text to use for images with
no specified alt text.

Adds parser tests for the image redirect case.

Change-Id: If5de59968d17054c9b8860513a08fdce6a4bb6c6
2022-09-27 02:37:13 -07:00
C. Scott Ananian
398e86f7c7 Make private deprecated public properties of Parser
This prepares for a split of the parser class.  These properties were
deprecated for public use in 1.35.

Some adjustments to phan annotations were necessary, as phan seems to
have a stronger analysis of the Parser class after this patch.

Bug: T236810
Bug: T236812
Change-Id: I66ad07d004a081096edec641141e787fc2cc0958
2022-09-19 23:44:56 -04:00
jenkins-bot
a166bda216 Merge "Parser: Use linkAnchor in section definition as well as anchor" 2022-09-15 19:18:47 +00:00
C. Scott Ananian
77fa68fcb9 Use more permissive match for TOC_PLACEHOLDER in parser output
Extensions can modify the HTML in various ways which could break a
too-specific search-and-replace for the TOC_PLACEHOLDER.  In particular,
DiscussionTools was postprocessing parser HTML in a way which was
breaking the TOC replacement in Parser::replaceTableOfContentsMarker()
(T317857), but in the future Parsoid might also emit slightly different
TOC markers, eg with additional attributes.

Make the search-and-replace more robust, at perhaps a small performance
cost.

Bug: T317857
Change-Id: Id0065d81bbfbe1bf6bea6af1de39ea7e9d6598d9
2022-09-15 12:03:38 -04:00
Jon Robson
d1662dca59 Parser: Use linkAnchor in section definition as well as anchor
The anchor property comes from Sanitizer::escapeIdForAttribute() and
should be used if you want to (eg) look up an element by ID using
document.getElementById(). The linkAnchor property comes from
Sanitizer::escapeIdForLink() and contains additional escaping
appropriate for use in a URL fragment, and should be used (eg) if you
are creating the href attribute of an <a> tag.

Bug: T315222
Change-Id: Icecf9640a62117c2729dca04af343fb1ddaaf8f8
2022-09-14 12:54:36 -04:00
jenkins-bot
61cbd18ff3 Merge "parser: Use a <meta> tag for the internal TOC_PLACEHOLDER" 2022-09-09 21:12:34 +00:00
Subramanya Sastry
c8a944a94b Add support to enable Scribunto & Parsoid to handle nowikis properly
* Lua modules have been written to inspect nowiki strip state markers
  and extract nowiki content to further process them. Callers might have
  used nowikis in arguments for any number of reasons including needing
  to have the argument be treated as raw text intead of wikitext.

  While we might add first-class typing features to wikitext, templates,
  extensions, and the like in the future which would let Parsoid process
  template arguments based on type info (rather than as wikitext always),
  we need a solution now to enable modules to work properly with Parsoid.

* The core issue is the decoupled model used by Parsoid where
  transclusions are preprocessed before further processing. Since
  nowikis cannot be processed and stripped during preprocessing,
  Lua modules don't have access to nowiki strip markers in this model.

* In this patch, we change extension tag processsing for nowikis.

  When generating HTML, nowikis are replaced with a 'nowiki' strip
  marker with the nowiki's "innerXML" (only tag contents).

  In this patch, during preprocessing, instead of adding a 'general'
  strip marker with the "outerXML" (tag contents and the tag wrapper),
  we add a 'nowiki' strip marker with its "outerXML".

* Since Parsoid (and any clients using the preprocessed output) will
  unstrip all strip markers, the shift from a general to nowiki
  strip marker won't make a difference.

* To support Scribunto and Lua modules unstrip usage, this patch adds
  new functionality to StripState to replace the (preprocessing-)nowiki
  strip markers with whatever its users want. So, Scribunto could
  pass in a callback that replaces these with the "innerXML" by
  stripping out the tag wrapper.

* Hat tip to Tim Starling for recommending this strategy.

* Updated strip state tests.

Bug: T272507
Bug: T299103
Depends-On: Id6ea611549e98893f53094116a3851e9c42b8dc8
Change-Id: Ied0295feab06027a8df885b3215435e596f0353b
2022-09-01 21:04:42 +00:00
Subramanya Sastry
98b3ddd7c7 Added Parsoid support for nowiki stripping in args of {{#tag:ext|...}}
* This patch relies on extensions setting a flag in their Parsoid ext.
  config indicating that a specific tag handler needs nowikis stripped
  from #tag arguments.

  In the #tag parser function implementation, Parsoid's SiteConfig is
  looked up to see if nowiki needs to be stripped.

* This need not be limited to nowikis, but to support extension use in
  {{#tag:ext|...}} more generally, we would need to either
  (a) implement the #tag parser function in Parsoid natively; OR
  (b) find a way to call Parsoid from extensionSubstitution

  Soln (a) needs Parsoid to support parser functions natively.

  If this general support becomes necessary, a later patch can
  generalize this appropriately.

Bug: T272939
Bug: T299103
Depends-On: I6a653889afd42fefb61daefd8ac842107dce8759
Depends-On: I56043e0cb7d355a3f0d08e429bb1dbba6acb4fba
Change-Id: I614153af67b5a14f33b7dfc04bd00dd9e03557d0
2022-08-20 20:56:54 -05:00
jenkins-bot
1ec9f4c6ed Merge "Deprecate the use of magic variables whose names contain a colon" 2022-08-19 14:31:03 +00:00
C. Scott Ananian
6f612678d0 Deprecate the use of magic variables whose names contain a colon
This reduces ambiguity between a parser function invocation (where the
colon separates the first argument) and a magic variable invocation
(where the colon is considered part of the magic variable name).

There shouldn't actually be any of these out in the wild, but it is
safer to deprecate than to assume.

Bug: T236813
Change-Id: I69e4f3b794f22a69efb98f5815df61199d077048
2022-08-18 13:39:00 +00:00
Bartosz Dziewoński
f7158c396d Add markup to page titles to distinguish the namespace and the main text
Pages outside of the main namespace now have the following markup in
their <h1> page titles, using 'Talk:Hello' as an example:

<h1>
  <span class="mw-page-title-namespace">Talk</span>
  <span class="mw-page-title-separator">:</span>
  <span class="mw-page-title-main">Hello</span>
</h1>
(line breaks and spaces added for readability)

Pages in the main namespace only have the last part, e.g. for 'Hello':

<h1>
  <span class="mw-page-title-main">Hello</span>
</h1>

The change is motivated by a desire to style the titles differently on
talk pages in the DiscussionTools extension (T313636), but it could
also be used for other things:
* Language-specific tweaks (e.g. adding typographically-correct spaces
  around the colon separator: T249149, or replacing it with a
  different character: T36295)
* Site-specific tweaks (e.g. de-emphasize or emphasize specific
  namespaces like 'Draft': T62973 / T236215)

The markup is also added to automatically language-converted titles.

It is not added when the title is overridden using the wikitext
`{{DISPLAYTITLE:…}}` or `-{T|…}-` forms. I think this is a small
limitation, as those forms mostly used in the main namespace, where
the extra markup isn't very helpful anyway. This may be improved in
the future. As a workaround, users could also just add the same HTML
markup to their wikitext (as those forms accept it).

It is not also added when the title is overridden by an extension
like Translate. Maybe we'll have a better API before anyone wants
to do that. If not, one could un-mark Parser::formatPageTitle()
as @internal, and use that method to add the markup themselves.

Bug: T306440
Change-Id: I62b17ef22de3606d736e6c261e542a34b58b5a05
2022-08-16 23:36:21 +00:00
jenkins-bot
20c8f5cdcf Merge "ParserGetVariableValueSwitchHook: Don't use the cache parameter" 2022-08-16 22:14:39 +00:00
jenkins-bot
a88926abba Merge "Remove ParserGetVariableVarCacheHook, deprecated in 1.35" 2022-08-16 21:49:02 +00:00
C. Scott Ananian
94d3b5dde8 ParserGetVariableValueSwitchHook: Don't use the cache parameter
Don't expose the parser's internal caching mechanism; shenanigans
with this parameter were deprecated in 1.35.

Bug: T236813
Change-Id: Iea74946c806d536ce321cba9675a7fabc117e4f1
2022-08-16 17:12:32 -04:00
C. Scott Ananian
0b10563895 parser: Use a <meta> tag for the internal TOC_PLACEHOLDER
Split out from the I44045b3b9e78e change.

This is consistent with what Parsoid will use for the TOC marker.

Bug: T287767
Bug: T270199
Bug: T311502
Depends-On: I1f607cf1ef1b61fb4d2e1880de756fb94d5a6b22
Change-Id: Ie63eed07b9bca1bfa07d4c256aba3728cedd8f93
2022-08-16 06:05:17 +00:00
C. Scott Ananian
fa8646ca7b parser: Prepare to use a <meta> tag for the internal TOC_PLACEHOLDER
Split out from the I44045b3b9e78e and Ie63eed07b9bca changes.  We
first add code to handle the new tag as well as the old tag in
ParserCache contents. This will allow us to safely rollback if needed
when deploying the follow-on patch which actually changes the tag
used.

Bug: T287767
Bug: T270199
Bug: T311502
Change-Id: Ib3e5e010b9f5ca2c4ea7c4fe28080170b6a88812
2022-08-15 18:54:52 -04:00
C. Scott Ananian
d57c6ddcce Remove ParserGetVariableVarCacheHook, deprecated in 1.35
This exposed internal cache mechanisms of the Parser, and appears
to have been originally added in c08da372bc
but is unused in any code indexed by codesearch.

Bug: T236813
Change-Id: Iaa5da572d76b1d396ecc7e3d3eb29c8d7d4bcddd
2022-08-12 13:28:25 -04:00
Thiemo Kreuz
e23b070b45 Make use of ?? and ?: operators where it makes sense
Change-Id: I1d9d62d80b17d1a05222c6e82f631cb801c311a8
2022-08-04 21:43:12 +02:00
Máté Szabó
36dd10f9de Migrate use of ${var}-style string interpolation
The "${var}" and "${expr}" style string interpolations are deprecated in
PHP 8.2. Migrate usages in core to "{$var}" as appropriate.

Bug: T314096
Change-Id: I269bad3d4a68c2b251b3e71a066289d4ad9fd496
2022-07-29 02:45:09 +02:00
C. Scott Ananian
6d5c62f5cf ParserOutputFlags: change HIDE_TOC to SHOW_TOC
When I implemented the ParserOutput merge logic in OutputPage
(I0909ac85c6c785d9089b077a16923c61d6a09996) I realized that
consistent "combine with OR" merge logic for the TOC flag
is obtained only if we invert the flag; that is, the existing
code showed a TOC *if any ParserOutput contained a shown TOC*
otherwise the TOC was hidden.

I'd originally implemented this in
I35e199cca40c0e4359ac493e5806dcf4ae49321c with the opposite sense in
order to avoid having to wait for ParserCache contents to expire:
since the default on most pages was to have the TOC shown anyway, if
"out of date" parser cache entries were missing a HIDE_TOC flag, it
wouldn't be a big deal, whereas if a SHOW_TOC flag were required then
upon deploy all cached pages would lose their TOC rendering.

BUT a better solution is just to let a "parser cache expiration time"
elapse between the time we start generating this flag and the time we
start using it.  The existing patch to export this
(I6cf76c870124c162dc1bcbc2f7e9ca0c5fdcd10e) uses
ParserOutput::getTOCHTML() anyway, so we can just wait to switch this
over to use the SHOW_TOC flag
(I10c3d06fb162103c06395bf9d1d27ac3c199d7b6) until the parser cache has
expired.

Anyway, this is a bit of a hassle to switch now, but I think having
consistent merge semantics for ParserOutput flags is worth the
short-term pain.

Bug: T310083
Change-Id: I3b76010f1e2283add629b84bf3824f215f932903
2022-07-27 18:45:59 -04:00
jenkins-bot
cae3d74a9b Merge "Parser: Make parser use current timestamp if RevisionRecord has null" 2022-07-27 09:20:57 +00:00
Brian Wolff
8e7d51fbea Parser: Make parser use current timestamp if RevisionRecord has null
RevisionRecord::getTimestamp is documented as potentially returning
null. Parser::getTimestamp() is documented as using the revision
timestamp if available, otherwise using the current timestamp, but
never returning null.

Change behaviour to match documentation.

This fixes a php warning on php 8.1 during tests.

Bug: T313663
Change-Id: I2b3e4d79ff5b179f013104eb2158c8e537a57545
2022-07-26 11:32:25 -07:00
C. Scott Ananian
cc79898522 ParserOption/ParserOutput flag to suppress or hide the table of contents
There are two related issues here: first, when parsing non-wikitext
pages for side effects (categories, etc) we want to ensure that any
spurious `===` or `<h2>` on the page don't create nonsense "sections".
We introduce a ParserOption to suppress the ToC in this case; a
follow-up patch will set this parser option from the correct path in
CodeContentHandler and its subclasses. [T307691]

Second, modern skins can generate the ToC on-the-fly outside the
content area, and need to be able to regenerate the ToC from API
output when the page is edited.  A ParserOutput flag is added to
mirror the $enoughToc variable from the parser to indicate whether
or not the ToC should be generated and/or updated after edit.
(See I6cf76c870124c162dc1bcbc2f7e9ca0c5fdcd10e for parallel code
to echo this value in ApiParse.)

Bug: T294950
Bug: T307691
Change-Id: I35e199cca40c0e4359ac493e5806dcf4ae49321c
2022-07-21 15:29:11 -04:00
Reedy
5d2feb1da1 Parser::extensionSubstitution() Don't run substr() on null
extensionSubstitution returns a string, not null,
so if $params['attr'] is not set, default to using
an empty string (''), not null.

Bug: T312519
Bug: T312520
Change-Id: I566d95a32cffe1ef20f18ae9d9af96d57e0823a9
2022-07-08 18:54:22 +00:00