Project

General

Profile

« Previous | Next » 

Revision 5c1fea17

Added by Stilez y about 8 years ago

If user-entered PHP errors out, display the error line in context to help the user

If the user enters PHP in the command-line page, and it errors out, it's usually a typo or something minor. But the user is left with an error that references a /tmp file which doesn't exist at the point they read the message, a line number that's incorrect, and their input which doesn't display line numbers anyhow.

This patch fixes this, so that a user who wants to enter php command-line in the GUI and gets an error, can quickly identify the exact line causing the error.

If an error occurs (detected by either non-zero return value or output matching an error message referencing the temp script file), then an short DIV is shown above the usual PHP output for "error location". It gives the correct error line number, and shows the code with line numbers and syntax highlighting (using php's native "-s" option), pre-scrolled to the error line.
(cherry picked from commit fd1bd705c5d460ddf5835b099aaa5cd102f64722)

  • added
  • modified
  • copied
  • renamed
  • deleted