Make WordPress Core

Opened 21 years ago

Closed 20 years ago

Last modified 19 years ago

#2122 closed defect (bug) (wontfix)

Patch for wp-db-backup

Reported by: pavonic Owned by:
Priority: normal Milestone:
Component: Administration Version: 2.0
Severity: major Keywords: backup plugin
Cc: Focuses:

Description

Hi, I'm submitting this ticket after I found a bug in the plugin WP-DB-Backup 1.7 that I use with Wordpress1.5. As this plugin is included in the next WP version maybe this can be useful.

I found that the backup_table() function does not handle NULL values, so the script generated may be incorrect.

To solve the problem I changed the loop:

foreach ($row as $key => $value) {
   if ($ints[strtolower($key)]) {
      $values[] = $value;
   } else {
      $values[] = "'" . str_replace($search, $replace, $this->sql_addslashes($value)) . "'";
   }
}

with the following got from http://www.restkultur.ch/personal/wolf/scripts/db_backup/:

foreach ($row as $key => $value) {
   if (!isset($row[$key])) {
      $values[]     = 'NULL';
   }
   else if ($value == '0' || $value != '') {
      // a number
      if ($ints[strtolower($key)]) {
         $values[] = $value;
      }
      else {
         $values[] = "'" . str_replace($search, $replace, $this->sql_addslashes($value)) . "'";
      }
   }
   else {
      $values[]     = "''";
   } 
}

With this change the backup script is more aderent to phpmyadmin.

Bye,
Cristian

Change History (4)

#1 @masquerade
21 years ago

  • Milestone2.0

#2 @skippy
21 years ago

  • Milestone 2.02.1

#3 @Nazgul
20 years ago

  • Resolutionwontfix
  • Status newclosed

wp-db-backup is no longer part of trunk.

#4 @Nazgul
19 years ago

  • Milestone 2.1
Note: See TracTickets for help on using tickets.