note 103928 modified in memcache.connect by danbrown

From: Date: Wed, 11 May 2011 19:16:17 +0000
Subject: note 103928 modified in memcache.connect by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179642@lists.php.net to get a copy of this message
To suppress (or handle) the warning and notice thrown by a failed attempt to connect, you can use a custom error handler function, like this: <?php function myErrorHandler($errno, $errstr, $errfile, $errline) { if (E_WARNING === $errno) { Log("PHP Warning: $errstr, $errfile, $errline", Logging::WARN); return true; } if (E_NOTICE === $errno) { Log("PHP Notic: $errstr, $errfile, $errline", Logging::NOTICE); return true; } return false; } set_error_handler('myErrorHandler'); ?> --was-- To suppress (or handle) the warning and notice thrown by a failed attempt to connect, you can use a custom error handler function, like this: function myErrorHandler($errno, $errstr, $errfile, $errline) { if (E_WARNING === $errno) { Log("PHP Warning: $errstr, $errfile, $errline", Logging::WARN); return true; } if (E_NOTICE === $errno) { Log("PHP Notic: $errstr, $errfile, $errline", Logging::NOTICE); return true; } return false; } set_error_handler('myErrorHandler'); http://php.net/manual/en/memcache.connect.php

« previous php.notes (#179642) next »