WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#2122 closed defect (bug) (wontfix)

Patch for wp-db-backup

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

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)

comment:1 @masquerade9 years ago

  • Milestone set to 2.0

comment:2 @skippy9 years ago

  • Milestone changed from 2.0 to 2.1

comment:3 @Nazgul8 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

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

comment:4 @Nazgul8 years ago

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