From: Erik Bernhardson Date: Mon, 10 Feb 2014 19:03:10 +0000 (-0800) Subject: Only pass strings to mysqli::real_escape_string X-Git-Tag: 1.31.0-rc.0~16964^2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=de808f57a90c9c6f7bc4dbc4e4b544a07e0daa0f;p=lhc%2Fweb%2Fwiklou.git Only pass strings to mysqli::real_escape_string HHVM will throw a fatal error when passing integer and other non-string values to mysqli::real_escape_string. A bug has been filed against hhvm as https://github.com/facebook/hhvm/issues/1782. Change-Id: I80eccbe8d872e74b8efc9b8c8f37ebce756bdcee --- diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php index d41f3e4c69..290de1f4ce 100644 --- a/includes/db/DatabaseMysqli.php +++ b/includes/db/DatabaseMysqli.php @@ -274,6 +274,10 @@ class DatabaseMysqli extends DatabaseMysqlBase { * @return string */ protected function mysqlRealEscapeString( $s ) { + if ( is_integer( $s ) ) { + // HHVM fatals passing numbers to real_escape_string + $s = (string) $s; + } return $this->mConn->real_escape_string( $s ); }