Jeroen De Dauw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/49923
Change subject: Added input to the hash generation of descriptions
......................................................................
Added input to the hash generation of descriptions
To be on the safe side for most, though getting rid of identical
hashes for conjunctions and disjunctions with the same sub descriptions
Change-Id: I3be0868592c1670f8a4ef8737b03b4da57a266e6
---
M includes/Ask/Language/Description/DescriptionCollection.php
M includes/Ask/Language/Description/SomeProperty.php
M includes/Ask/Language/Description/ValueDescription.php
3 files changed, 13 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Ask
refs/changes/23/49923/1
diff --git a/includes/Ask/Language/Description/DescriptionCollection.php
b/includes/Ask/Language/Description/DescriptionCollection.php
index 3632026..6bdd45b 100644
--- a/includes/Ask/Language/Description/DescriptionCollection.php
+++ b/includes/Ask/Language/Description/DescriptionCollection.php
@@ -164,15 +164,18 @@
public function getHash() {
$this->sortCollection( $this->descriptions );
- return sha1( implode(
- '|',
- array_map(
- function( Hashable $hashable ) {
- return $hashable->getHash();
- },
- $this->descriptions
+ return sha1(
+ $this->getType() .
+ implode(
+ '|',
+ array_map(
+ function( Hashable $hashable ) {
+ return $hashable->getHash();
+ },
+ $this->descriptions
+ )
)
- ) );
+ );
}
/**
diff --git a/includes/Ask/Language/Description/SomeProperty.php
b/includes/Ask/Language/Description/SomeProperty.php
index a2622b3..07d39cf 100644
--- a/includes/Ask/Language/Description/SomeProperty.php
+++ b/includes/Ask/Language/Description/SomeProperty.php
@@ -158,7 +158,7 @@
* @return string
*/
public function getHash() {
- return sha1( $this->property->getHash() .
$this->description->getHash() );
+ return sha1( $this->getType() . $this->property->getHash() .
$this->description->getHash() );
}
}
diff --git a/includes/Ask/Language/Description/ValueDescription.php
b/includes/Ask/Language/Description/ValueDescription.php
index 21a9d93..072d8f7 100644
--- a/includes/Ask/Language/Description/ValueDescription.php
+++ b/includes/Ask/Language/Description/ValueDescription.php
@@ -176,7 +176,7 @@
* @return string
*/
public function getHash() {
- return sha1( $this->value->getHash() . $this->comparator );
+ return sha1( $this->getType() . $this->value->getHash() .
$this->comparator );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/49923
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3be0868592c1670f8a4ef8737b03b4da57a266e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Ask
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits