Last modified: 2006-06-04 01:50:59 UTC
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).
Hopefully an internal error should never happen. ;) What's an example of an error message return? How would this be handled?
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. 2. 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). 3. 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?