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

       Web browser: ---
            Bug ID: 60213
           Summary: Type mismatch when caching SMW IDs
           Product: MediaWiki extensions
           Version: unspecified
          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: ---

MediaWiki        1.22.1                (721b9e0) 22:03, 14 January 2014
Semantic MediaWiki (Version 1.9 alpha-3) (9a55761) 19:21, 22 October 2013

mediawiki/extensions/SemanticMediaWiki/includes/storage/SQLStore:

(SMW_Sql3SmwIds.php)SMWSql3SmwIds->setCache() is called from

(SMW_SQLStore3_Queries.php)SMWSQLStore3QueryEngine->getInstanceQueryResult()

with $id that is string, not integer as documented for setCache.

In most cases it is not a problem, php cast values automatically.
But arrays containing ids are serialized 
when hashes for property tables are computed.
In this case, types of ids are important - serialized arrays differs
and md5 hashes also differs.

For example (take a look at s_id or p_id):

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;}}

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";}}

These hashes are used to compare new semantic data 
with current semantic data stored in database to avoid unnecessary writes.

Fortunately functionality is not affected, only performance.

I propose to add explicit type cast in
(SMW_Sql3SmwIds.php)SMWSql3SmwIds->setCache() method
to make sure ids are always integer.

-- 
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