Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #42 from bertrandmalet/master

Fix error on insert with PDO
  • Loading branch information...
commit 160fb23f11a6ef18131e282d710db2b01d1d40dc 2 parents 8b4e9c3 + 59dace8
@preinheimer authored
Showing with 12 additions and 5 deletions.
  1. +9 −2 xhprof_lib/utils/Db/Pdo.php
  2. +3 −3 xhprof_lib/utils/xhprof_runs.php
View
11 xhprof_lib/utils/Db/Pdo.php
@@ -53,8 +53,7 @@ public function connect()
public function query($sql)
{
- $this->curStmt = $this->db->prepare($sql);
- $this->curStmt->execute();
+ $this->curStmt = $this->db->query($sql);
return $this->curStmt;
}
@@ -65,11 +64,19 @@ public static function getNextAssoc($resultSet)
public function escape($str)
{
+ $str = $this->db->quote($str);
+ //Dirty trick, PDO::quote add quote around values (you're beautiful => 'you\'re beautiful')
+ // which are already added in xhprof_runs.php
+ $str = substr($str, 0, -1);
+ $str = substr($str, 1);
return $str;
}
public function affectedRows()
{
+ if ($this->curStmt === false) {
+ return 0;
+ }
return $this->curStmt->rowCount();
}
View
6 xhprof_lib/utils/xhprof_runs.php
@@ -96,8 +96,8 @@ protected function db()
public static function getDbClass()
{
- global $_xhprof;
-
+ global $_xhprof;
+
$class = 'Db_'.$_xhprof['dbadapter'];
return $class;
}
@@ -267,7 +267,7 @@ public function get_run($run_id, $type, &$run_desc)
//The Performance data is compressed lightly to avoid max row length
if (!isset($GLOBALS['_xhprof']['serializer']) || strtolower($GLOBALS['_xhprof']['serializer'] == 'php')) {
- $contents = unserialize(gzuncompress(base64_decode($data['perfdata'])));
+ $contents = unserialize(gzuncompress($data['perfdata']));
} else {
$contents = json_decode(gzuncompress($data['perfdata']), true);
}
Please sign in to comment.
Something went wrong with that request. Please try again.