Page MenuHomePhabricator

Misleading error message in SyntaxHighlight rev. 1.1 as of June, 2005
Closed, InvalidPublic

Description

Author: kexo

Description:
When an internal error occurs in GeSHi, SyntaxHighlight.php reports this in
exactly the same way as SyntaxHighlight.php reports bad usage: "You need to
specify a language ..."
This misleads users into believing they did something wrong in specifying a
language, while in reality the error lies somewhere else, deep down in GeSHi.

Possible remedy: Modify SyntaxHighlight so that the usage message (syntaxHelp
with no parameter as called from syntaxHook) is distinguished from error
messages (syntaxHelp with one parameter as called from syntaxFormat).


Version: unspecified
Severity: minor
OS: Windows XP
Platform: PC
URL: http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/Highlight/SyntaxHighlight.php?rev=1.1&view=markup

Details

Reference
bz4890

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:05 PM
bzimport set Reference to bz4890.
bzimport added a subscriber: Unknown Object (MLST).

Hopefully an internal error should never happen. ;)

What's an example of an error message return? How would this be handled?

kexo wrote:

Example steps to reproduce behavior (the language java serves as an
example here - this works with any language):

  1. In Mediawiki, view or preview a page containing the content '<source

lang="java">{ System.out.println("Test"); }</source>'. Text is
successfully highlighted using GeSHi.

  1. On the file system level, deny everybody read access to the

file /extensions/geshi/geshi/java.php (including the account used by the
web server and by PHP).

  1. In Mediawiki, reload or preview again the page. The page now contains

the misleading error message "You need to specify a language ..."
(4. Undo step 2 to regain functionality.)

Diagnosis: GeSHi passes a valid error message to SyntaxHighlight.php: In
SyntaxHighlight.php, in method syntaxFormat, the error message is
retrieved (call to $geshi->error()) and SyntaxHighlight.php stores this
message in variable $error. Then, SyntaxHighlight.php passes the value of
the variable $error to the function syntaxHelp, but the latter method
fails to output the value of this (optional) parameter or to do anything
with it.

If you have to break your own server, well... Hardly seems
like an issue?