Support nightmare: a customer reports a random PHP MySQL error. As a support expert you have the strong feeling that it is down to some suspicious SQL sequence. How to proof? 25 lines of PECL/mysqlnd_uh swiss-army knife magic…
prepend.php
class __mysqlnd_logger extends MysqlndUhConnection { private $protocol; public function query($conn, $query) { $ret = parent::query($conn, $query); if ($errno = $this->getErrorNumber($conn)) { $this->protocol[] = array( "query" => $query, "error" => sprintf("[%d] %s", $errno, $this->getErrorString($conn)), "bt" => debug_backtrace() ); } else { $this->protocol[] = $query; } return $ret; } public function getProtocol() { return $this->protocol; } } $__logger = new __mysqlnd_logger(); mysqlnd_uh_set_connection_proxy($__logger);
The …
[Read more]