Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.
Bug: T153505
Change-Id: Ib31f3bbffdd6b25ad9a21498294644e4dde33bd1
Add a sanity check to the math extension that skips shelling out to
texvc if the input is insanely large.
Bug: T129506
Change-Id: I2c7b6561464bddb4c3eab9230fa8168b24adaa37
This reverts commit e674d7e73b.
That commit does not help to solve T134281.
It adds a CSS class name which is configurable
by a global variable to various math elements, which is confusing.
Change-Id: Iea5f231e0cea1221dc717b3409b36c0baf11bb24
This is the fix for the bug that makes the whole page scroll when long
equations are present in the wiki article.
Bug: T134281
Change-Id: I29f8df027384098cd0923bcfa23a914c8d887bba
The signature of the Hook function is not respected.
Thus parameters need to be passed by reference explicitly.
For syntax validation to pass, this requires
mediawiki-codesniffer to 0.6.0
Change-Id: I90b6501000200c1b462407b769113358eb5c762f
Most info-level log entries are actually debug messages, which should
not end up in the production log by default, so adjust them.
Only the Mathoid-powered TeX check fail has been promoted to info so
that we can quickly identify such requests from pages.
Bug: T121445
Change-Id: I3736c59f6425d675befea9438182ee1cdebe5fc5
* Do not contact RESTbase in texvc rendering mode and
use the well established tex checking that is already build
into texvc.
* Do not use RESTbase in LaTeXML mode.
Background:
In I1982612e8c6a356e3dbdf447724ac82e5968cc77 RESTbased replaced
texvccheck that was a derivate of texvc designed for people
that wanted to use secure MathML rendering using mathoid.
The integration of mathoid to restbase made this feature obsolete.
However, texvccheck was not only used to check the latex input
that was sent to mathoid, but also the string which was sent to texvc.
Since texvc has already build in tex checking this is not
required and does not improve security.
Finally, users updating from old versions of the math extension
(prior to 2014) that do not have textexvccheck installed,
do not need to compile the texvccheck binary after this change.
PS5: Also treats the case where VisualEditor is not installed.
Bug: T121173
Change-Id: I1bd076b09206869b5ed75280d22e1b36bfb8d8ad
* Use string constants instead of integers
* Derive new names from old via conversion of constant
naming convention to CamelCase.
* Replace old constant string e.g. 'MW_MATH_ABC_DEF'
with new string 'abcDef'
* Replace old constant value with new string.
* Tests to demonstrates what is actually done.
* Rename constants
Bug: T106630
Bug: T106631
Bug: T87941
Change-Id: I6d1094ece79e912d9ddbef6681a25196c7a6e801
The workaround to save PNG images calls the hook wrong,
the parameters must be passed as references.
Bug: T105598
Change-Id: Ic77aa79aa6e2bf2a9ec00be4cc775d0123bed91a
- Merge fallback-svg and fallback-png into one fallback-image class.
- Move the vertical centering of PNG to MathTexvc and ext.math.js.
- Remove "img" from ext.math.css to reduce CSS specificity and make
style easier to override by user stylesheets.
- Add a comment about the !important rules for centering in
display mode.
- Only load ext.math.scripts in MathML mode.
Bug: 71955
Change-Id: If8ee1cf6453257a0a2f6aa186d4007954a8e5d8e
Use the cached function isInDatabase rather than readFromDatabase to
avoid unnecessary read operations on the database.
Currently, readFromDatabase is usually called only once during instance
livetime. But after I455b41c8b8d918f4c34f6c115194d227a8394e0a has bben
merged chances are that it's called twice.
Change-Id: I6434195ad1d323a578a8fdca1b4555e11ab30a15
Currently the method render always returns
a html string that can be a string that
represents the correct result or a rendered
error message.
This change splits rendering and
fetching of the HTML output.
This simplifies the logic of the rendering
and caching mechanism.
Now the render method returns a boolean that
indicates if the rendering was sucessful or
not.
Step 2/2
Warning: Errors in this change might affect
caching logic and squid caches.
Change-Id: I00502b84212ed70cdf63bd69916a35afbd6fdbc1
Currently the method render always returns
a html string that can be a string that
represents the correct result or a rendered
error message.
This change adds a mechanism that allows
to fetch the HTML output.
In a followup commit the rendering function
is changed to return a boolean value rather
than the rendering result.
This will simplify the error handling and caching.
Change-Id: I80760493e391911c41eb69d75a93c6a34db8852e
Currently the PNG and the LaTeXML rendering mode
use a common table in the database. If both rendering
modes are allowed in a wiki simultaneously this causes
problems, because the fields are continuously overwritten.
This is patch changes the logic of the rendering
engine to use the specific database.
The caching logic is now simpler to understand.
A entry is written to the database if the changed field
of the MathRenderer class is true. Is is triggered by the
setters of the database relevant fields.
Bug: 65522
Change-Id: Ief9de889b9292b21c9d1529a8b1797f38196edad
Currently the PNG and the LaTeXML rendering mode
use a common table in the database. If both rendering
modes are allowed in a wiki simultaneously this causes
problems, because the fields are continuously overwritten.
This change adds the method getMathTableName that will
allow renderers to access their specific table in the
database.
Change-Id: I8b11ffd0a39fadd7d3c8de1e94e74ff5f490430d
* Removes the MathJax heuristics that decides
if equations are centered or left-aligned.
* Introduces the attribute display to specify
if the math element is rendered in inline,
display, or inline-displaystyle.
* add css rules for display / inline math images
Bug: 61051
Change-Id: Iba69903f781f0cb1606b8ddcffb90fb86c9b229b
* Include generated tests for a better test coverage
of the Math extension.
* Compiles texvc in testsuite (if required)
* Test generator now included
* Replaces the old parser tests
* Fixes whitspace issues
Bug: 61090
Change-Id: Iff7eeb5ee72137492c3f6659e4d4d106e5715586
* Otherwise all future <math> hits will check the wrong file
(which may not exist), recreate the png, and store over the
proper file (even if it was already there). Update the DB to
point to the right hash instead.
bug: 60997
Change-Id: Ib833ad32ff1e4506e9b8ab2cc1b72516cb072cd5
The output of texvccheck is not only "checked" but also
rewritten to another form.
(For example $\R$ is transformed to $\mathbb{R}$.)
But the output might not be a valid input for the thexvccheck
part of texvc, like it happened in for the example given in the bug
description.
See also I599c4390da9b8f36d800f379a33ad5ce90f5096c
Bug: 61012
Change-Id: Iae5e350cb78c0e637e574390c586fbdb8dc38496
The user input specified in the math tag a. la
<math>E=m <script>alert('attacked')</script>^2 </math>
is verified in PNG rendering mode, but not in plaintext, MathJax
or LaTeXML rendering mode. This is a potential security issue.
Furthermore, the texvc specific commands such as $\reals$
that is expanded to $\mathbb{R}$ might be rendered differently
depended on the rendering mode.
Therefore, the security checking and rewriting portion of texvc
have been extracted from the texvc source
(see I1650e6ec2ccefff6335fbc36bbe8ca8f59db0faa) and are
now available as a separate executable (texvccheck).
This commit will now enable this enhancement in security and
provide even more compatibility among the different rendering
modes.
Bug: 49169
Change-Id: Ida24b6bf339508753bed40d2e218c4a5b7fe7d0c
This patch adds wfDebugLog() calls for conditions related to texvc invocations.
The logs are grouped under a 'texvc' group, added for this purpose. The reason
for logging into a separate channel is that the Math channel is too verbose for
production use on the Wikimedia cluster.
Change-Id: I05a17a0230f49f5d698b91617d06b3e3f838b67d