[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_5_0ALPHA1-832-gf5ffad3

Madhura Jayaratne madhuracj at users.sourceforge.net
Sun Jan 22 07:44:37 CET 2012


The branch, master has been updated
       via  f5ffad3583fd436381b3ced82b8aa1d4ae75f2a0 (commit)
       via  3c7b233d9c83b501f5e220a6dcba8259b7554a87 (commit)
       via  5da1aaa0fe7493afecde8ac92a0b561337bf217e (commit)
      from  48b951996997742574fbe2935f51a56e56986e7f (commit)


- Log -----------------------------------------------------------------
commit f5ffad3583fd436381b3ced82b8aa1d4ae75f2a0
Merge: 48b9519 3c7b233
Author: Madhura Jayaratne <madhura.cj at gmail.com>
Date:   Sun Jan 22 12:10:44 2012 +0530

    Merge branch 'QA_3_4'
    
    Conflicts:
    	libraries/tbl_replace_fields.inc.php

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                            |    1 +
 libraries/tbl_replace_fields.inc.php |    6 ++++--
 tbl_replace.php                      |    7 +++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d605f0c..95f4a2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,7 @@ phpMyAdmin - ChangeLog
 - bug #3463933 [display] SELECT DISTINCT displays wrong total records found
 - patch #3458944 [operations] copy table data missing SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'
 - bug #3469254 [edit] Setting data to NULL and drop-downs
+- bug #3477063 [edit] Missing set fields and values in generated INSERT query
 
 3.4.9.0 (2011-12-21)
 - bug #3442028 [edit] Inline editing enum fields with null shows no dropdown
diff --git a/libraries/tbl_replace_fields.inc.php b/libraries/tbl_replace_fields.inc.php
index 8e27290..0f6a3df 100644
--- a/libraries/tbl_replace_fields.inc.php
+++ b/libraries/tbl_replace_fields.inc.php
@@ -59,17 +59,19 @@ if (false !== $possibly_uploaded_val) {
     }
 
     // $key contains the md5() of the fieldname
-    if (0 === strlen($val) && $type != 'protected') {
+    if ($type != 'protected' && $type != 'set' && 0 === strlen($val)) {
         // best way to avoid problems in strict mode (works also in non-strict mode)
         if (isset($me_auto_increment)  && isset($me_auto_increment[$key])) {
             $val = 'NULL';
         } else {
             $val = "''";
-        } 
+        }
     } elseif ($type == 'set') {
         if (! empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) {
             $val = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]);
             $val = "'" . PMA_sqlAddSlashes($val) . "'";
+        } else {
+             $val = "''";
         }
     } elseif ($type == 'protected') {
         // here we are in protected mode (asked in the config)
diff --git a/tbl_replace.php b/tbl_replace.php
index 8b8a58d..6ba156d 100644
--- a/tbl_replace.php
+++ b/tbl_replace.php
@@ -223,7 +223,7 @@ foreach ($loop_array as $rownumber => $where_clause) {
     if ($is_insert && $using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($where_clause)) {
         $prot_row = PMA_DBI_fetch_single_row('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';');
     }
-    
+
     // When a select field is nullified, it's not present in $_REQUEST
     // so initialize it; this way, the foreach($me_fields) will process it
     foreach ($me_fields_name as $key => $val) {
@@ -232,7 +232,10 @@ foreach ($loop_array as $rownumber => $where_clause) {
         }
     }
 
-    foreach ($me_fields as $key => $val) {
+    // Iterate in the order of $me_fields_name, not $me_fields, to avoid problems
+    // when inserting multiple entries
+    foreach ($me_fields_name as $key => $field_name) {
+        $val = $me_fields[$key];
 
         // Note: $key is an md5 of the fieldname. The actual fieldname is available in $me_fields_name[$key]
 


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list