[wp-trac] [WordPress Trac] #37699: Death to Globals Episode #1: A Registry, A Pattern

WordPress Trac noreply at wordpress.org
Sun Aug 28 22:40:18 UTC 2016


#37699: Death to Globals Episode #1: A Registry, A Pattern
----------------------------+------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  4.7
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------

Comment (by dlh):

 A report from "the wild": [38279] broke a site I work on. But, there are a
 lot of steps to replicating what happened, and a plugin is involved. It
 might be impossible for core to account for a case like it.

 1. This site caches some `WP_Query` objects as transients. The serialized
 `WP_Query` now includes The `$db` property.
 2. I have Query Monitor enabled, including its `QM_DB` class.
 3. `QM_DB` keeps a trace of queries, and any objects in the trace are
 serialized into the transient, too.
 4. One of the classes on this site tries to prevent you from unserializing
 it by adding a `__wakeup()` method with `wp_die()`. That object was
 serialized in the trace, and when it was later unserialized via
 `get_transient()`, it called `wp_die()`.

 I would also note that an exception would have been thrown when setting
 the transient if a closure had been in the trace: `'Serialization of
 'Closure' is not allowed'`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37699#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list