Liangent has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/53556


Change subject: Do proper nullity check for $this->hash.
......................................................................

Do proper nullity check for $this->hash.

I assume the original author wants to catch null or false, but some
valid hashes may be evaluated as false, causing database error
"1048: Column 'math_outputhash' cannot be null". Valid hashes must be
strings, so I'm changing it to is_string() check.

Change-Id: I852859f4b151b777c11b743faaed61dfc2c029a7
---
M MathRenderer.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/56/53556/1

diff --git a/MathRenderer.php b/MathRenderer.php
index 10676aa..cbd2b95 100644
--- a/MathRenderer.php
+++ b/MathRenderer.php
@@ -154,7 +154,7 @@
                # Now save it back to the DB:
                if ( !wfReadOnly() ) {
                        $dbw = wfGetDB( DB_MASTER );
-                       if ( $this->hash ) {
+                       if ( is_string( $this->hash ) ) {
                                $outmd5_sql = $dbw->encodeBlob( pack( 'H32', 
$this->hash ) );
                        } else {
                                $outmd5_sql = null;

-- 
To view, visit https://gerrit.wikimedia.org/r/53556
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I852859f4b151b777c11b743faaed61dfc2c029a7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Liangent <liang...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to