Fixes #311 Due to a memory handling issue in PHP core Mocks might cause PHP to error out when called in a destructor.