Skip to content

Why WP Stream Wrappers is needed

jmstacey edited this page Aug 30, 2010 · 3 revisions

You may be wondering why WP Stream Wrappers is really needed if PHP5 has stream wrapper support. The answer is that a handful of PHP’s built-in functions are not compatible with stream wrappers. In order to provide our own stream-compatible alternatives a stream wrapper registry apart from the PHP stream wrapper registry was needed so that function calls are properly routed to the right wrapper implementation. The WP Stream Wrapper Registry wraps around the PHP wrapper registry, so wrapper developers need only interact with a single API.

Function alternatives

  • wp_chmod()
  • wp_realpath()
  • wp_tempnam_stream_compatible() → Temporary name because wp_tempnam() already exists.
  • wp_dirname()
  • wp_touch()