Author: allex
Description:
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.
Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=53034