diff --git a/ChangeLog b/ChangeLog index f1bab95142..56c1918d58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -65,6 +65,7 @@ phpMyAdmin - ChangeLog - issue #11909 Can't insert row into table that contains generated column - issue #11677 sql-parser and php-gettext collide. - issue #11920 Can't disable backquotes in export +- issue #11911 Inserts via tbl_change.php in VARBINARY columns does not allow using HEX() and MD5() 4.5.4.1 (2016-01-29) - issue #11892 Error with PMA 4.4.15.3 diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 820a55a81a..8e75536d0b 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -2292,13 +2292,15 @@ function PMA_getQueryValuesForInsertAndUpdateInMultipleEdit($multi_edit_columns_ * @param boolean $using_key whether editing or new row * @param string $where_clause where clause * @param string $table table name + * @param array $multi_edit_funcs multiple edit functions array * * @return string $current_value current column value in the form */ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key, $multi_edit_columns_type, $current_value, $multi_edit_auto_increment, $rownumber, $multi_edit_columns_name, $multi_edit_columns_null, - $multi_edit_columns_null_prev, $is_insert, $using_key, $where_clause, $table + $multi_edit_columns_null_prev, $is_insert, $using_key, $where_clause, $table, + $multi_edit_funcs ) { // Fetch the current values of a row to use in case we have a protected field if ($is_insert @@ -2313,6 +2315,8 @@ function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key, if (false !== $possibly_uploaded_val) { $current_value = $possibly_uploaded_val; + } else if (! empty($multi_edit_funcs[$key])) { + $current_value = "'" . PMA_Util::sqlAddSlashes($current_value) . "'"; } else { // c o l u m n v a l u e i n t h e f o r m if (isset($multi_edit_columns_type[$key])) { diff --git a/tbl_replace.php b/tbl_replace.php index a09d5de93d..f8522ae477 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -254,7 +254,7 @@ foreach ($loop_array as $rownumber => $where_clause) { $current_value, $multi_edit_auto_increment, $rownumber, $multi_edit_columns_name, $multi_edit_columns_null, $multi_edit_columns_null_prev, $is_insert, - $using_key, $where_clause, $table + $using_key, $where_clause, $table, $multi_edit_funcs ); $current_value_as_an_array = PMA_getCurrentValueAsAnArrayForMultipleEdit( diff --git a/test/libraries/PMA_insert_edit_test.php b/test/libraries/PMA_insert_edit_test.php index ddd5b71627..473a7f5a34 100644 --- a/test/libraries/PMA_insert_edit_test.php +++ b/test/libraries/PMA_insert_edit_test.php @@ -2448,7 +2448,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase $result = PMA_getCurrentValueForDifferentTypes( '123', '0', array(), '', array(), 0, array(), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2459,7 +2459,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 2 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('test'), '', array(1), 0, array(), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2470,7 +2470,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 3 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('test'), '', array(), 0, array(), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2482,7 +2482,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase $_REQUEST['fields']['multi_edit'][0][0] = array(); $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('set'), '', array(), 0, array(), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2493,7 +2493,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 5 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('protected'), '', array(), 0, array('a'), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2504,7 +2504,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 6 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('protected'), '', array(), 0, array('a'), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2515,7 +2515,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 7 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('bit'), '20\'12', array(), 0, array('a'), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2526,7 +2526,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 7 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('date'), '20\'12', array(), 0, array('a'), array(), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2538,7 +2538,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase $_REQUEST['fields']['multi_edit'][0][0] = array(); $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('set'), '', array(), 0, array(), array(1), - array(), true, true, '1', 'table' + array(), true, true, '1', 'table', array() ); $this->assertEquals( @@ -2549,7 +2549,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase // case 9 $result = PMA_getCurrentValueForDifferentTypes( false, '0', array('protected'), '', array(), 0, array('a'), array(), - array(1), true, true, '1', 'table' + array(1), true, true, '1', 'table', array() ); $this->assertEquals(