Page MenuHomePhabricator

Put wrapped data in mw.loadData cache
Closed, DeclinedPublic

Description

Each time mw.loadData is called, it calls dataWrapper at the end. Maybe it would make more sense to put the wrapped data in the cache?

Also, maybe this could make table lookup significantly faster, because the seen variable in dataWrapper would be have to be fed only once.

if not data then
    ...
    data = dataWrapper(data)
    loadedData[module] = data
end
return data

https://github.com/wikimedia/mediawiki-extensions-Scribunto/blob/master/engines/LuaCommon/lualib/mw.lua

Event Timeline

Jackmcbarn subscribed.

Passing the same dataWrapper result more than once would introduce another way that T67258 could happen.

(2024 here, coming from the duplicate T381224)

@Jackmcbarn, you raised the concern of not allowing transmission through #invoke's, but from my understanding, you didn't state that the suggested change would actually introduce this issue.

I reviewed it again, and the wrapped tables are designed to be read-only. Neither I nor the AI that I consulted could find a way to bypass this.

Jackmcbarn hasn't been active for years so won't respond.

Neither I nor the AI that I consulted could find a way to bypass this.

Try using the rawset function.

Jackmcbarn hasn't been active for years so won't respond.

I had noticed it, but still pinged, just in case.

Try using the rawset function.

I didn't think of that one. Sadly, I haven't figured out any way to prevent it. Even though using it would be unexpected and strictly forbidden, people will do it.

Therefore, nothing more to do here. Please forgive me if I forget about it and open another ticket in 2032.