WordPress.org

Make WordPress Core

Opened 3 weeks ago

#50678 new defect (bug)

Transient: save object with protected attributes will fail

Reported by: mxlq Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3
Component: Options, Meta APIs Keywords:
Focuses: Cc:

Description

When I save a custom object with protected attributes no value is set into database.

I think it's because php's serialize function use null bytes (\0) when serializing protected properties. MySql does not complain so function returns true like everthing is normal.

See this stack overflow post.

I'm using:

  • WordPress 5.3.4
  • MySql Ver 15.1 Distrib 10.3.22-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2.
  • PHP Version 7.3.19-1~deb10u1

Change History (0)

Note: See TracTickets for help on using tickets.