mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-29 11:10:18 +02:00
[ticket/17142] Fix DBMS+cache related PHP warnings while installing
PHPBB3-17142
This commit is contained in:
@@ -1245,4 +1245,25 @@ abstract class driver implements driver_interface
|
||||
|
||||
return $rows_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure query ID can be used by cache
|
||||
*
|
||||
* @param resource|int|string $query_id Mixed type query id
|
||||
*
|
||||
* @return int|string Query id in string or integer format
|
||||
*/
|
||||
public function clean_query_id($query_id)
|
||||
{
|
||||
// Some DBMS functions accept/return objects and/or resources instead if identifiers
|
||||
// Attempting to use objects/resources as array keys will throw error, hence correctly handle all cases
|
||||
if (is_resource($query_id))
|
||||
{
|
||||
return function_exists('get_resource_id') ? get_resource_id($query_id) : (int) $query_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return is_object($query_id) ? spl_object_id($query_id) : $query_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user