https://bugzilla.wikimedia.org/show_bug.cgi?id=53034

       Web browser: ---
            Bug ID: 53034
           Summary: Property value changed after page move without
                    redirect
           Product: MediaWiki extensions
           Version: master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: Semantic MediaWiki
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: al...@all-x.net
                CC: jamesin.hongkon...@gmail.com, jeroen_ded...@yahoo.com,
                    mar...@semantic-mediawiki.org, nischay...@gmail.com
    Classification: Unclassified
   Mobile Platform: ---

Created attachment 13125
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=13125&action=edit
Recorded actions for Selenium IDE, no checks

If there is a subobject with property pointing to some page, sometimes when
page is moved (without redirect), semantic data of that object's property
(incorrectly) updated to point at new page.

I've found two related problems in source code.

Versions:
MediaWiki     1.21.1 (56e8075)
Semantic MediaWiki (Version 1.9 alpha)     (69e25c6)

I use this test case:

1. Create page '1' with text '1'
2. Create page 'S' with text {{#subobject:|Type=T|Property=1}}
3. Create page 'Q' with text {{#ask: [[Type::T]]|?Property|format=table}}
4. Check that 'S' is shown in query result table and Property=1
5. Move '1' to 'One' without redirect
6. Check that 'S' is shown at page 'Q' in query result table and Property=1
7. Create page '1' again with text '2'
8. Move '1' to 'Two' without redirect
9. Check that 'S' is shown at page 'Q' in query result table and Property=Two
but should be Property=1

Analysis:
1. wikipage '1' created, s_id=51

2. Add semantic info about subobject with two properties:
DatabaseBase::query: INSERT  INTO `smw_di_wikipage` (s_id,p_id,o_id) VALUES
('53','55','51'),('53','56','57') 

Add hash about this data:
DatabaseBase::query: UPDATE  `smw_object_ids` SET smw_proptable_hash =
'a:1:{s:15:\"smw_di_wikipage\";s:32:\"c43e412734de47975c15442da48c01ca\";}'
WHERE smw_id = '53'

Hash is md5 of this serialized array:
smw_di_wikipage data:
a:2:{i:0;a:3:{s:4:"s_id";i:53;s:4:"p_id";i:55;s:4:"o_id";s:2:"51";}i:1;a:3:{s:4:"s_id";i:53;s:4:"p_id";i:56;s:4:"o_id";i:57;}}

5. wikipage 'One' created, s_id=60
Move semantic info from '1' to 'One':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET s_id = '60' WHERE s_id
= '51'
Change references from '1' to 'One':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET o_id = '60' WHERE o_id
= '51'

BUG: hash is not updated!

It's located somewhere near
SMW_SQLStore3_Writers.php line 711 calls SMWSQLStore3->changeSMWPageID()
SMW_SQLStore3.php line 315 calls SMWSQLStore3Writers->changeTitle()

Refresh semantic data of page 'S' (in update job):
Serialized array:
smw_di_wikipage data:
a:2:{i:0;a:3:{s:4:"s_id";s:2:"53";s:4:"p_id";s:2:"55";s:4:"o_id";s:2:"51";}i:1;a:3:{s:4:"s_id";s:2:"53";s:4:"p_id";s:2:"56";s:4:"o_id";s:2:"57";}}

md5 hash: 8ddbfffecc91e9fd86703ef843e2b7a2

BUG: the array describes the same data but hash differs because keys are
strings, not integers as before. 
I hate dynamic typing!

But because hashes are different we write correct info:
DatabaseBase::query: DELETE FROM `wiki_smw_di_wikipage` WHERE (s_id='53' AND
((p_id = '55' AND o_id = '60')))
DatabaseBase::query: INSERT  INTO `wiki_smw_di_wikipage` (s_id,p_id,o_id)
VALUES ('53','55','51')
DatabaseBase::query: UPDATE  `wiki_smw_object_ids` SET smw_proptable_hash =
'a:1:{s:15:\"smw_di_wikipage\";s:32:\"8ddbfffecc91e9fd86703ef843e2b7a2\";}'
WHERE smw_id = '53'

7. wikipage '1' created, s_id=51

8. wikipage 'Two' created, s_id=61
Move semantic info from '1' to 'Two':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET s_id = '61' WHERE s_id
= '51'
Change references from '1' to 'One':
DatabaseBase::query: UPDATE  `wiki_smw_di_wikipage` SET o_id = '61' WHERE o_id
= '51'

BUG: hash is not updated!

Update job doesn't write correct info because at this time hashes are equal
(bug is not compensated as before) and we see Property=Two in query result
table.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to