simetrical@svn.wikimedia.org schreef:
Revision: 41085 Author: simetrical Date: 2008-09-21 02:53:24 +0000 (Sun, 21 Sep 2008)
Log Message:
Prohibit empty page titles at a low level
This adds a sanity check to EditPage::doEdit() that throws an exception if the Title's name (sans namespace) is empty. Apparently the API edit module doesn't handle this error correctly at a high level, as evidenced by page 19405691 on enwiki. I didn't try to test whether this extra check stops the particular error, but it doesn't hurt in any case.
<snip> + if( $this->mTitle->getText() == '' ) {
This makes me wonder: I thought the Title constructor returned null when asked to create such titles? Has this behavior changed? If not, I'm very curious how on earth an invalid Title object manages to 1) exist and 2) find its way into EditPage::doEdit().
Roan Kattouw (Catrope)
On Sun, Sep 21, 2008 at 2:38 PM, Roan Kattouw roan.kattouw@home.nl wrote:
This makes me wonder: I thought the Title constructor returned null when asked to create such titles? Has this behavior changed? If not, I'm very curious how on earth an invalid Title object manages to 1) exist and 2) find its way into EditPage::doEdit().
A wikilink like [[#Foo]] corresponds to a Title object with no text, only a fragment. This is perfectly valid and makes plenty of sense for links. It's just not a kind of Title that you want to add to the database.
Another case you have to look out for is non-local Titles, i.e., Titles with an interwiki component. Titles with negative namespaces are also valid but can't be put in the database. There are probably other cases too. I don't know if the API will handle all of those correctly right now.
On Sun, Sep 21, 2008 at 8:53 PM, Aryeh Gregor Simetrical+wikilist@gmail.com wrote:
On Sun, Sep 21, 2008 at 2:38 PM, Roan Kattouw roan.kattouw@home.nl wrote:
This makes me wonder: I thought the Title constructor returned null when asked to create such titles? Has this behavior changed? If not, I'm very curious how on earth an invalid Title object manages to 1) exist and 2) find its way into EditPage::doEdit().
A wikilink like [[#Foo]] corresponds to a Title object with no text, only a fragment. This is perfectly valid and makes plenty of sense for links. It's just not a kind of Title that you want to add to the database.
Another case you have to look out for is non-local Titles, i.e., Titles with an interwiki component. Titles with negative namespaces are also valid but can't be put in the database. There are probably other cases too. I don't know if the API will handle all of those correctly right now.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
In that case we should perhaps have a Title::isValidDbKey and call that from Article:doEdit and similar.
Bryan
wikitech-l@lists.wikimedia.org