Daniel Werner has submitted this change and it was merged.

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

Approvals:
  Daniel Werner: Verified; Looks good to me, approved
  jenkins-bot: Checked



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: merged
Gerrit-Change-Id: I3be0868592c1670f8a4ef8737b03b4da57a266e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Ask
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Daniel Werner <[email protected]>
Gerrit-Reviewer: John Erling Blad <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to