Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a9194ab932
@ -88,6 +88,7 @@ VerboseMultiSubmit, ReplaceHelpImg
|
||||
- Upgraded CodeMirror to 2.37
|
||||
|
||||
3.5.7.0 (not yet released)
|
||||
- bug #3779 [core] Problem with backslash in enum fields
|
||||
|
||||
3.5.6.0 (not yet released)
|
||||
- bug #3593604 [status] Erroneous advisor rule
|
||||
|
||||
@ -3046,61 +3046,7 @@ class PMA_Util
|
||||
|
||||
if ('enum' == $type || 'set' == $type) {
|
||||
// Define our working vars
|
||||
$enum_set_values = array();
|
||||
$working = "";
|
||||
$in_string = false;
|
||||
$index = 0;
|
||||
|
||||
// While there is another character to process
|
||||
while (isset($columnspec[$index])) {
|
||||
|
||||
// Grab the char to look at
|
||||
$char = $columnspec[$index];
|
||||
|
||||
// If it is a single quote, needs to be handled specially
|
||||
if ($char == "'") {
|
||||
// If we are not currently in a string, begin one
|
||||
if (! $in_string) {
|
||||
$in_string = true;
|
||||
$working = "";
|
||||
} else {
|
||||
// Otherwise, it may be either an end of a string,
|
||||
// or a 'double quote' which can be handled as-is
|
||||
// Check out the next character (if possible)
|
||||
$has_next = isset($columnspec[$index + 1]);
|
||||
$next = $has_next ? $columnspec[$index + 1] : null;
|
||||
|
||||
// If we have reached the end of our 'working' string
|
||||
// (because there are no more chars,or the next char
|
||||
// is not another quote)
|
||||
if (! $has_next || $next != "'") {
|
||||
$enum_set_values[] = $working;
|
||||
$in_string = false;
|
||||
} elseif ($next == "'") {
|
||||
// Otherwise, this is a 'double quote',
|
||||
// and can be added to the working string
|
||||
$working .= "'";
|
||||
// Skip the next char; we already know what it is
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ('\\' == $char
|
||||
&& isset($columnspec[$index + 1])
|
||||
&& "'" == $columnspec[$index + 1]
|
||||
) {
|
||||
// escaping of a quote?
|
||||
$working .= "'";
|
||||
$index++;
|
||||
} else {
|
||||
// Otherwise, add it to our working string like normal
|
||||
$working .= $char;
|
||||
}
|
||||
|
||||
// Increment character index
|
||||
$index++;
|
||||
} // end while
|
||||
|
||||
$enum_set_values = self::parseEnumSetValues($columnspec, false);
|
||||
$printtype = $type
|
||||
. '(' . str_replace("','", "', '", $spec_in_brackets) . ')';
|
||||
$binary = false;
|
||||
@ -4031,10 +3977,11 @@ class PMA_Util
|
||||
*
|
||||
* @param string $definition The definition of the column
|
||||
* for which to parse the values
|
||||
* @param bool $escapeHtml Whether to escape html entitites
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function parseEnumSetValues($definition)
|
||||
public static function parseEnumSetValues($definition, $escapeHtml = true)
|
||||
{
|
||||
$values_string = htmlentities($definition);
|
||||
// There is a JS port of the below parser in functions.js
|
||||
@ -4074,6 +4021,12 @@ class PMA_Util
|
||||
$values[] = $buffer;
|
||||
}
|
||||
|
||||
if (! $escapeHtml) {
|
||||
foreach ($values as $key => $value) {
|
||||
$values[$key] = html_entity_decode($value, ENT_QUOTES);
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
@ -888,8 +888,6 @@ function PMA_getColumnEnumValues($column, $extracted_columnspec)
|
||||
{
|
||||
$column['values'] = array();
|
||||
foreach ($extracted_columnspec['enum_set_values'] as $val) {
|
||||
// Removes automatic MySQL escape format
|
||||
$val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val));
|
||||
$column['values'][] = array(
|
||||
'plain' => $val,
|
||||
'html' => htmlspecialchars($val),
|
||||
|
||||
@ -57,9 +57,9 @@ class PMA_extractColumnSpec_test extends PHPUnit_Framework_TestCase
|
||||
'enum_set_values' => array('a', 'b'),
|
||||
'attribute' => ' ',
|
||||
'can_contain_collation' => true,
|
||||
'displayed_type' => "set('a', 'b')",
|
||||
),
|
||||
'displayed_type' => "set('a', 'b')"
|
||||
),
|
||||
),
|
||||
array(
|
||||
"SET('\'a','b')",
|
||||
array(
|
||||
@ -72,9 +72,9 @@ class PMA_extractColumnSpec_test extends PHPUnit_Framework_TestCase
|
||||
'enum_set_values' => array("'a", 'b'),
|
||||
'attribute' => ' ',
|
||||
'can_contain_collation' => true,
|
||||
'displayed_type' => "set('\'a', 'b')",
|
||||
),
|
||||
'displayed_type' => "set('\'a', 'b')"
|
||||
),
|
||||
),
|
||||
array(
|
||||
"SET('''a','b')",
|
||||
array(
|
||||
@ -87,9 +87,24 @@ class PMA_extractColumnSpec_test extends PHPUnit_Framework_TestCase
|
||||
'enum_set_values' => array("'a", 'b'),
|
||||
'attribute' => ' ',
|
||||
'can_contain_collation' => true,
|
||||
'displayed_type' => "set('''a', 'b')",
|
||||
),
|
||||
'displayed_type' => "set('''a', 'b')"
|
||||
),
|
||||
),
|
||||
array(
|
||||
"ENUM('a&b', 'b''c\\'d', 'e\\\\f')",
|
||||
array(
|
||||
'type' => 'enum',
|
||||
'print_type' => "enum('a&b', 'b''c\\'d', 'e\\\\f')",
|
||||
'binary' => false,
|
||||
'unsigned' => false,
|
||||
'zerofill' => false,
|
||||
'spec_in_brackets' => "'a&b', 'b''c\\'d', 'e\\\\f'",
|
||||
'enum_set_values' => array('a&b', 'b\'c\'d', 'e\\f'),
|
||||
'attribute' => ' ',
|
||||
'can_contain_collation' => true,
|
||||
'displayed_type' => "enum('a&b', 'b''c\\'d', 'e\\\\f')"
|
||||
),
|
||||
),
|
||||
array(
|
||||
"INT UNSIGNED zerofill",
|
||||
array(
|
||||
@ -102,9 +117,9 @@ class PMA_extractColumnSpec_test extends PHPUnit_Framework_TestCase
|
||||
'enum_set_values' => array(),
|
||||
'attribute' => 'UNSIGNED ZEROFILL',
|
||||
'can_contain_collation' => false,
|
||||
'displayed_type' => "int",
|
||||
),
|
||||
'displayed_type' => "int"
|
||||
),
|
||||
),
|
||||
array(
|
||||
"VARCHAR(255)",
|
||||
array(
|
||||
@ -117,9 +132,9 @@ class PMA_extractColumnSpec_test extends PHPUnit_Framework_TestCase
|
||||
'enum_set_values' => array(),
|
||||
'attribute' => ' ',
|
||||
'can_contain_collation' => true,
|
||||
'displayed_type' => "varchar(255)",
|
||||
),
|
||||
'displayed_type' => "varchar(255)"
|
||||
),
|
||||
),
|
||||
array(
|
||||
"VARBINARY(255)",
|
||||
array(
|
||||
@ -132,9 +147,9 @@ class PMA_extractColumnSpec_test extends PHPUnit_Framework_TestCase
|
||||
'enum_set_values' => array(),
|
||||
'attribute' => ' ',
|
||||
'can_contain_collation' => false,
|
||||
'displayed_type' => "varbinary(255)",
|
||||
),
|
||||
'displayed_type' => "varbinary(255)"
|
||||
),
|
||||
);
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user