WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7201 closed defect (bug) (duplicate)

Dead code in maybe_serialize function

Reported by: jacobsantos Owned by: westi
Milestone: Priority: low
Severity: trivial Version: 2.5
Component: General Keywords:
Focuses: Cc:

Description

Looking at the code of maybe_serialize() caused some confusion, because it doesn't appear that the code will ever execute as the first if branch will always evaluate serialized data to be true. This means that when the execution gets down to

    if ( is_serialized( $data ) )   // <--- Always false
        return serialize( $data );  // <--- Dead Code

This probably needs to be moved up a bit to the top of the function body.

Attachments (1)

4029.testcases.diff (2.7 KB) - added by jacobsantos 7 years ago.
Test cases for maybe_serialize()

Download all attachments as: .zip

Change History (7)

@jacobsantos7 years ago

Test cases for maybe_serialize()

comment:1 @jacobsantos7 years ago

The test cases need to be patched in the wp-testcases folder in the Automattic WordPress Tests repository.

comment:2 @jacobsantos7 years ago

There has been a previous discussion on the topic in #4029 and I suppose the expected result is that serialized data should be serialized again.

comment:3 @jacobsantos7 years ago

  • Keywords needs-patch dev-feedback added; has-patch removed

comment:4 @westi7 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

comment:5 @santosj7 years ago

  • Milestone 2.7 deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #7347.

comment:6 @santosj7 years ago

  • Keywords needs-patch needs-testing dev-feedback removed
Note: See TracTickets for help on using tickets.