bug #3486970 [import] Exception on XML import

This commit is contained in:
Madhura Jayaratne
2012-02-18 14:43:05 +05:30
parent 0a4357121e
commit 0d1407f178
4 changed files with 21 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog
====================== ======================
3.4.11.0 (not yet released) 3.4.11.0 (not yet released)
- bug #3486970 [import] Exception on XML import
3.4.10.0 (2012-02-14) 3.4.10.0 (2012-02-14)
- bug #3460090 [interface] TextareaAutoSelect feature broken - bug #3460090 [interface] TextareaAutoSelect feature broken

View File

@@ -169,13 +169,14 @@ class PMA_Error extends PMA_Message
*/ */
public function getHash() public function getHash()
{ {
$backtrace = PMA_isSerializable($this->getBacktrace()) ? serialize($this->getBacktrace()) : '';
if (null === $this->_hash) { if (null === $this->_hash) {
$this->_hash = md5( $this->_hash = md5(
$this->getNumber() . $this->getNumber() .
$this->getMessage() . $this->getMessage() .
$this->getFile() . $this->getFile() .
$this->getLine() . $this->getLine() .
serialize($this->getBacktrace()) $backtrace
); );
} }

View File

@@ -3020,4 +3020,21 @@ function PMA_buildActionTitles() {
$titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true); $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
return $titles; return $titles;
} }
/**
* Determines whether a variable is serializable.
*
* @param object $var object which needs to be checked for serializability
*
* @return whether the object is serializable.
*/
function PMA_isSerializable($var)
{
try {
serialize($var);
return true;
} catch(Exception $e) {
return false;
}
}
?> ?>

View File

@@ -186,7 +186,7 @@ $data_present = false;
/** /**
* Only attempt to analyze/collect data if there is data present * Only attempt to analyze/collect data if there is data present
*/ */
if (@count($xml->children())) { if ($xml && @$xml->count()) {
$data_present = true; $data_present = true;
/** /**