Page MenuHomePhabricator

Title class may return outdated content model
Closed, ResolvedPublic

Description

In eval.php:

$t1 = Title::newFromText( 'New page' );
echo $t1->getContentModel();

wikitext

$page = WikiPage::factory( $t1 );
$content = ContentHandler::makeContent( 'foo', null, CONTENT_MODEL_TEXT );
$page->doEditContent( $content, 'summary' );
$t2 = Title::newFromText( 'New page' );
echo $t2->getContentModel();

wikitext // should be 'text' instead

This is probably caused by bug 69788 ( $t1->mContentModel, populated in $t1->getContentModel(), ends up being cached and used for $t2).


Version: 1.24rc
Severity: normal

Details

Reference
bz69789

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:28 AM
bzimport set Reference to bz69789.
bzimport added a subscriber: Unknown Object (MLST).
wctaiwan created this task.Aug 20 2014, 4:45 PM

Change 155292 had a related patch set uploaded by Wctaiwan:
Set and get object copies in MapCacheLRU

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

(In reply to wctaiwan from comment #0)

This is probably caused by bug 69788 ( $t1->mContentModel, populated in
$t1->getContentModel(), ends up being cached and used for $t2).

At least for this particular case, this bug isn't what you think it is. That code should work because WikiPage::insertOn() calls Title::resetArticleID(), which clears the property in question. I'll upload a patch shortly.

Change 155453 had a related patch set uploaded by PleaseStand:
Title::getContentModel(): load from DB if necessary

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

Change 155292 abandoned by Wctaiwan:
Set and get object copies in MapCacheLRU

Reason:
Current cache behaviour seems to be expected. Bug 69789 is instead fixed with I94f06baf406afa538cd2b10139598442f9fc6759

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

Change 155453 merged by jenkins-bot:
Title::getContentModel(): load from DB if necessary

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

All patches mentioned in this report were merged or abandoned - is there more work left to do here (if yes: please reset the bug report status to NEW or ASSIGNED), or can you close this ticket as RESOLVED FIXED?

Sorry, I'd just forgotten.