Replacement for the standard PHP serializer