Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10767 closed defect (bug) (wontfix)

stripslashes_deep does not gracefully handle objects

Reported by: sowsinsk Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8.4
Component: General Keywords: stripslashes_deep
Focuses: Cc:


The stripslashes_deep() function in formatting.php will throw a catchable fatal error if it encounters an object. This is because the function always call stripslashes() on the given argument unless the argument is an array. However, if you pass an array to stripslashes_deep(), and one of the elements of the array is an object, it will throw the fatal error.

I realize that this function is not normally called on object values, however I have had this problem when stripslashes_deep is called on the result of a get_comment($id, ARRAY_A) call. This is because that call to get_comment returns an array that, depending on if the wp cache is used to return a comment object that's already been retrieved and perhaps has additional object data embedded in the array, might have object data in it.

Change History (2)

#1 @scribu
12 years ago

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

get_comment() should already have slashes stripped.

Either way, it's a bad practice, imho.

#2 @Denis-de-Bernardy
12 years ago

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