fix phpTypecast bugs

if phpType is string and value type is resource, we must use `stream_get_contents` to cast value to string, instead of return the resource handle.