Merge remote-tracking branch 'origin/QA_3_5' into QA_3_5

This commit is contained in:
Weblate 2013-01-15 19:05:23 +01:00
commit 0d5633d0d9
4 changed files with 32 additions and 17 deletions

View File

@ -6,6 +6,7 @@ phpMyAdmin - ChangeLog
- bug #3596070 [status] localStorage broken in server status monitor
- bug #3598736 [routines] Editing a procedure with special characters
- bug #3600322 [core] Visualize GIS data throws Fatal Error
- bug #3599362 [core] Double-escaped error message
3.5.5.0 (2012-12-21)
- bug #3563824 [export] Support Apache's mod_deflate

View File

@ -84,6 +84,21 @@ class PMA_Error_Handler
/**
* Error handler - called when errors are triggered/occured
*
* This calls the addError() function, escaping the error string
*
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
*/
public function handleError($errno, $errstr, $errfile, $errline)
{
$this->addError($errstr, $errno, $errfile, $errline, $escape=true);
}
/**
* Add an error; can also be called directly (with or without escaping)
*
* The following error types cannot be handled with a user defined function:
* E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR,
* E_COMPILE_WARNING,
@ -96,11 +111,15 @@ class PMA_Error_Handler
* @param string $errstr
* @param string $errfile
* @param integer $errline
* @param boolean $escape
*/
public function handleError($errno, $errstr, $errfile, $errline)
public function addError($errstr, $errno, $errfile, $errline, $escape=true)
{
if ($escape) {
$errstr = htmlspecialchars($errstr);
}
// create error object
$error = new PMA_Error($errno, htmlspecialchars($errstr), $errfile, $errline);
$error = new PMA_Error($errno, $errstr, $errfile, $errline);
// do not repeat errors
$this->_errors[$error->getHash()] = $error;
@ -131,6 +150,7 @@ class PMA_Error_Handler
}
}
/**
* log error to configured log facility
*

View File

@ -277,7 +277,12 @@ function PMA_warnMissingExtension($extension, $fatal = false, $extra = '')
if ($fatal) {
PMA_fatalError($message);
} else {
trigger_error($message, E_USER_WARNING);
$GLOBALS['error_handler']->addError(
$message,
E_USER_WARNING,
'',
'',
$escape=false);
}
}

View File

@ -15,11 +15,9 @@ require_once 'libraries/core.lib.php';
class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
{
function testMissingExtention(){
$ext = 'php_ext';
$this->setExpectedException('PHPUnit_Framework_Error',
'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.');
PMA_warnMissingExtension($ext);
protected function setUp() {
require_once './libraries/Error_Handler.class.php';
$GLOBALS['error_handler'] = new PMA_Error_Handler();
}
function testMissingExtentionFatal(){
@ -47,13 +45,4 @@ class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
$this->assertGreaterThan(0, strpos($printed, $warn));
}
function testMissingExtentionWithExtra(){
$ext = 'php_ext';
$extra = 'Appended Extra String';
$this->setExpectedException('PHPUnit_Framework_Error',
'The [a@'.PMA_getPHPDocLink('book.' . $ext . '.php').'@Documentation][em]'.$ext.'[/em][/a] extension is missing. Please check your PHP configuration.'.' '.$extra);
PMA_warnMissingExtension($ext, false, $extra);
$this->assertTrue(true);
}
}