From de808f57a90c9c6f7bc4dbc4e4b544a07e0daa0f Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Mon, 10 Feb 2014 11:03:10 -0800 Subject: [PATCH] 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 --- includes/db/DatabaseMysqli.php | 4 ++++ 1 file changed, 4 insertions(+) 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 ); } -- 2.20.1