Page MenuHomePhabricator

WrappedString: Throw an exception if suffix/prefix does not match the wrapped string
Closed, ResolvedPublic

Description

Not sure what appropriate project is for wikimedia/wrappedString library. Do i even file this on phab or somewhere else?

I was recently experimenting with some code, and i accidentally changed the value of a wrapped string, without changing its prefix. This caused some subtle breakage without it being immediately obvious what the cause was. I think it would be much nicer for the programmer if wrapped string threw an exception if the prefix or suffix isnt actually the prefix or suffix of the respective wrappedstring

?

Details

Related Changes in Gerrit:

Event Timeline

Bawolff raised the priority of this task from to Needs Triage.
Bawolff updated the task description. (Show Details)
Bawolff added a project: good first task.
Bawolff subscribed.

@Bawolff: Where exactly is the codebase of this?

Meh, not even Utilities-code-utils covers this. :( No idea where it expects its bug reports. Or who is maintainer.

@Krinkle is the author, I presume he is the maintainer too.

In the initial version, the prefix/suffix was by design matching as they were separate parameters. This was changed in v2.0 with rGWST46e7b3d36f65: [BREAKING CHANGE] Consider content to include prefix/suffix / https://gerrit.wikimedia.org/r/228182.

Krinkle renamed this task from WrappedString should throw an exception if suffix/prefix is not actually a suffix/prefix of the wrapped string to WrappedString: Throw an exception if suffix/prefix does not match the wrapped string.Nov 27 2015, 3:43 PM
Krinkle set Security to None.

Change 597835 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[WrappedString@master] tests: Observe behaviour upon invalid input

https://gerrit.wikimedia.org/r/597835

Change 597835 merged by jenkins-bot:
[WrappedString@master] Throw upon invalid prefix/suffix

https://gerrit.wikimedia.org/r/597835