Permalink
Browse files

fix(php): Suppress mysql_connect() deprecation warnings for core

Elgg 2.0 no longer uses ext/mysql, so these warnings are just a nuisance
for 1.x site owners and plugin devs.

Fixes #9245
  • Loading branch information...
mrclay committed Dec 18, 2015
1 parent a8de1c4 commit 40fe0a8f4d36e7a3f0947c9f4148b7ccb8f0a0ee
Showing with 10 additions and 0 deletions.
  1. +10 −0 engine/lib/elgglib.php
View
@@ -881,6 +881,16 @@ function _elgg_php_exception_handler($exception) {
* @todo Replace error_log calls with elgg_log calls.
*/
function _elgg_php_error_handler($errno, $errmsg, $filename, $linenum, $vars) {
// Elgg 2.0 no longer uses ext/mysql, so these warnings are just a nuisance for 1.x site
// owners and plugin devs.
if (0 === strpos($errmsg, "mysql_connect(): The mysql extension is deprecated")) {
// only suppress core's usage
if (preg_match('~/classes/Elgg/Database\.php$~', strtr($filename, '\\', '/'))) {
return true;
}
}
$error = date("Y-m-d H:i:s (T)") . ": \"$errmsg\" in file $filename (line $linenum)";
switch ($errno) {

0 comments on commit 40fe0a8

Please sign in to comment.