mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-73520-M311_replace-deprecated-php_errormsg-with-error_get_last' of https://github.com/ziegenberg/moodle into MOODLE_311_STABLE
This commit is contained in:
commit
e40b7928c9
5 changed files with 29 additions and 17 deletions
|
@ -134,11 +134,19 @@ function sendOAuthParamsPOST($method, $endpoint, $oauth_consumer_key, $oauth_con
|
|||
$ctx = stream_context_create($params);
|
||||
$fp = @fopen($endpoint, 'rb', false, $ctx);
|
||||
if (!$fp) {
|
||||
throw new \Exception("Problem with $endpoint, $php_errormsg");
|
||||
$message = "(No error message provided.)";
|
||||
if ($error = error_get_last()) {
|
||||
$message = $error["message"];
|
||||
}
|
||||
throw new \Exception("Problem with $endpoint, $message");
|
||||
}
|
||||
$response = @stream_get_contents($fp);
|
||||
if ($response === false) {
|
||||
throw new \Exception("Problem reading data from $endpoint, $php_errormsg");
|
||||
$message = "(No error message provided.)";
|
||||
if ($error = error_get_last()) {
|
||||
$message = $error["message"];
|
||||
}
|
||||
throw new \Exception("Problem reading data from $endpoint, $message");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
|
|
@ -208,11 +208,19 @@ function do_post_request($url, $data, $optional_headers = null)
|
|||
$fp = @fopen($url, 'rb', false, $ctx);
|
||||
if (!$fp) {
|
||||
echo @stream_get_contents($fp);
|
||||
throw new Exception("Problem with $url, $php_errormsg");
|
||||
$message = "(No error message provided.)";
|
||||
if ($error = error_get_last()) {
|
||||
$message = $error["message"];
|
||||
}
|
||||
throw new Exception("Problem with $url, $message");
|
||||
}
|
||||
$response = @stream_get_contents($fp);
|
||||
if ($response === false) {
|
||||
throw new Exception("Problem reading data from $url, $php_errormsg");
|
||||
$message = "(No error message provided.)";
|
||||
if ($error = error_get_last()) {
|
||||
$message = $error["message"];
|
||||
}
|
||||
throw new Exception("Problem reading data from $url, $message");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
|
|
@ -5,3 +5,4 @@ In future releases we should look into using a supported library.
|
|||
|
||||
2022-01-05 - MDL-73502 - Removed get_magic_quotes_gpc() use, was returning false since ages ago.
|
||||
2022-01-20 - MDL-73523 - Conditional openssl_free_key() use, deprecated by PHP 8.0
|
||||
2022-03-05 - MDL-73520 - replace deprecated php_errormsg with error_get_last(), deprecated by PHP 8.0
|
||||
|
|
|
@ -109,7 +109,6 @@ class ADODB_db2 extends ADOConnection {
|
|||
|
||||
private function doDB2Connect($argDSN, $argUsername, $argPassword, $argDatabasename, $persistent=false)
|
||||
{
|
||||
global $php_errormsg;
|
||||
|
||||
if (!function_exists('db2_connect')) {
|
||||
ADOConnection::outp("DB2 extension not installed.");
|
||||
|
@ -181,8 +180,6 @@ class ADODB_db2 extends ADOConnection {
|
|||
null,
|
||||
$db2Options);
|
||||
|
||||
$php_errormsg = '';
|
||||
|
||||
$this->_errorMsg = @db2_conn_errormsg();
|
||||
|
||||
if ($this->_connectionID && $this->connectStmt)
|
||||
|
@ -205,8 +202,6 @@ class ADODB_db2 extends ADOConnection {
|
|||
private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatabasename)
|
||||
{
|
||||
|
||||
global $php_errormsg;
|
||||
|
||||
$connectionParameters = array('dsn'=>'',
|
||||
'uid'=>'',
|
||||
'pwd'=>'',
|
||||
|
@ -256,7 +251,6 @@ class ADODB_db2 extends ADOConnection {
|
|||
$errorMessage = 'Supply uncatalogued connection parameters ';
|
||||
$errorMessage.= 'in either the database or DSN arguments, ';
|
||||
$errorMessage.= 'but not both';
|
||||
$php_errormsg = $errorMessage;
|
||||
if ($this->debug)
|
||||
ADOConnection::outp($errorMessage);
|
||||
return null;
|
||||
|
@ -281,7 +275,6 @@ class ADODB_db2 extends ADOConnection {
|
|||
{
|
||||
$errorMessage = 'For uncatalogued connections, provide ';
|
||||
$errorMessage.= 'both UID and PWD in the connection string';
|
||||
$php_errormsg = $errorMessage;
|
||||
if ($this->debug)
|
||||
ADOConnection::outp($errorMessage);
|
||||
return null;
|
||||
|
@ -316,7 +309,6 @@ class ADODB_db2 extends ADOConnection {
|
|||
{
|
||||
$errorMessage = 'Uncatalogued connection parameters ';
|
||||
$errorMessage.= 'must contain a database= argument';
|
||||
$php_errormsg = $errorMessage;
|
||||
if ($this->debug)
|
||||
ADOConnection::outp($errorMessage);
|
||||
return null;
|
||||
|
@ -1579,10 +1571,6 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
|
|||
function _query(&$sql,$inputarr=false)
|
||||
{
|
||||
|
||||
GLOBAL $php_errormsg;
|
||||
|
||||
if (isset($php_errormsg))
|
||||
$php_errormsg = '';
|
||||
$this->_error = '';
|
||||
|
||||
$db2Options = array();
|
||||
|
@ -1621,7 +1609,12 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/db2/htm/db2
|
|||
|
||||
if ($stmtid == false)
|
||||
{
|
||||
$this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
|
||||
$this->_errorMsg = @db2_stmt_errormsg();
|
||||
$this->_errorCode = @db2_stmt_error();
|
||||
|
||||
if ($this->debug)
|
||||
ADOConnection::outp($this->_errorMsg);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,3 +26,5 @@ Added:
|
|||
|
||||
Our changes (to be checked on next update if they are already applied upstream)::
|
||||
* https://github.com/ADOdb/ADOdb/issues/711
|
||||
Our changes (to be checked on next update if they are already applied upstream):
|
||||
* https://github.com/ADOdb/ADOdb/issues/791
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue