Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7871 closed defect (bug) (fixed)

Using stripslashes malforms arrays for post metadata

Reported by: jacobsantos Owned by: jacobsantos
Milestone: 2.7 Priority: highest omg bbq
Severity: blocker Version: 2.7
Component: General Keywords: has-patch tested commit
Focuses: Cc:


In the database, the gallery has _wp_attachment_metadata set as "Array" this means that somewhere in the execution path, the meta data value was converted to a string. Following the execution has found that stripslashes() is the cause of the malformed array meta data values.

The patch solves this problem and keeps the stripslashes for strings. The recommendation is to remove the requirement that strings have slashes added in order to simplify the code.

Attachments (1)

7871.r9124.diff (4.8 KB) - added by jacobsantos 7 years ago.
Fix for malformed array in database based off of r9124

Download all attachments as: .zip

Change History (9)

@jacobsantos7 years ago

Fix for malformed array in database based off of r9124

comment:1 @jacobsantos7 years ago

  • Summary changed from Using stripslashes malforms arrays to Using stripslashes malforms arrays for post metadata

comment:2 @jacobsantos7 years ago

  • Owner changed from anonymous to jacobsantos

comment:3 @jacobsantos7 years ago

  • Status changed from new to assigned

comment:4 @ShaneF7 years ago

  • Keywords commit added
  • Version set to 2.7

This is a major error. It even fixes problems I was having in #7607.

comment:5 @jacobsantos7 years ago

  • Keywords has-patch tested added

comment:6 @azaozz7 years ago

Why not just use stripslashes_deep(). It works for both arrays and strings.

comment:7 @azaozz7 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9129]) Fix stripslashes for post metadata, phpDoc updates for media.php, props jacobsantos, fixes #7871

comment:8 @ShaneF7 years ago

I am going to test this later to make sure.

Note: See TracTickets for help on using tickets.