Skip to content

Commit

Permalink
SafeStream: unregister protocols in cleaner way [Closes #6]
Browse files Browse the repository at this point in the history
  • Loading branch information
salatos authored and dg committed Mar 19, 2016
1 parent 43c26e4 commit 4b9bb32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/SafeStream/SafeStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ class SafeStream
*/
public static function register()
{
@stream_wrapper_unregister('safe'); // old protocol
stream_wrapper_register('safe', __CLASS__);
@stream_wrapper_unregister(self::PROTOCOL); // intentionally @
foreach (array_intersect(stream_get_wrappers(), array('safe', self::PROTOCOL)) as $name) {
stream_wrapper_unregister($name);
}
stream_wrapper_register('safe', __CLASS__); // old protocol
return stream_wrapper_register(self::PROTOCOL, __CLASS__);
}

Expand Down

0 comments on commit 4b9bb32

Please sign in to comment.