-- INSERT INTO #PFX#bin5_tournaments (code, active, name) VALUES (1, 1, 'normal match');
-- INSERT INTO #PFX#bin5_tournaments (code, active, name) VALUES (2, 1, 'special match');
-UPDATE #PFX#bin5_tournaments SET (name) = ('old rules: with draw') WHERE code = 1;
-UPDATE #PFX#bin5_tournaments SET (name) = ('new rules: without draw') WHERE code = 2;
+-- pg10+: "SET (col) = (val)" su una sola colonna non e' piu' valido
+UPDATE #PFX#bin5_tournaments SET name = 'old rules: with draw' WHERE code = 1;
+UPDATE #PFX#bin5_tournaments SET name = 'new rules: without draw' WHERE code = 2;
INSERT INTO #PFX#bin5_tournaments (code, active, name) VALUES (3, 1, 'special match');
if (PHP_INT_SIZE == 4)
return ($l);
- return ( ($l & 0x80000000 ? 0xffffffff00000000 : 0x00) | $l );
+ /* php8.1: the literal 0xffffffff00000000 is above PHP_INT_MAX, so php treats
+ it as a float and the or converts it back to int, raising the
+ "Implicit conversion from float ... to int loses precision" deprecation
+ on every call. ~0xffffffff is the same bit pattern but stays an integer.
+ Identical values produced, checked on 0, 1, 0x7fffffff, 0x80000000,
+ 0xc0a80001 and 0xffffffff. */
+ return ( ($l & 0x80000000) ? ($l | ~0xffffffff) : $l );
}
function four2int($s)
{
GLOBAL $G_dbpfx;
- $user_sql = sprintf("UPDATE %susers SET (lintm) = (date 'epoch' + %d * INTERVAL '1 second') WHERE code = %d;", $G_dbpfx, $lintm, $code);
+ /* pg10+: "SET (col) = (val)" on a SINGLE column is an error, because
+ (val) is not a ROW but a parenthesised expression. The multi column
+ form is still valid and is left as it is. */
+ $user_sql = sprintf("UPDATE %susers SET lintm = date 'epoch' + %d * INTERVAL '1 second' WHERE code = %d;", $G_dbpfx, $lintm, $code);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
return FALSE;
{
GLOBAL $G_dbpfx;
- $user_sql = sprintf("UPDATE %susers SET (pass) = (md5('%s')) WHERE code = %d;",
+ /* pg10+: single column without parentheses, see user_update_login_time() */
+ $user_sql = sprintf("UPDATE %susers SET pass = md5('%s') WHERE code = %d;",
$G_dbpfx, $passwd, $code);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
{
GLOBAL $G_dbpfx;
- $user_sql = sprintf("UPDATE %susers SET (tos_vers) = ('%s') WHERE code = %d;",
+ /* pg10+: single column without parentheses, see user_update_login_time() */
+ $user_sql = sprintf("UPDATE %susers SET tos_vers = '%s' WHERE code = %d;",
$G_dbpfx, escsql($tos_vers), $code);
if ( ! (($user_pg = $this->query($user_sql)) != FALSE && pg_affected_rows($user_pg) == 1) ) {
return FALSE;
for ($i = 0 ; $i < $n ; $i++) {
$codes_where .= sprintf("%scode = %d", ($i == 0 ? "" : " OR "), $ucodes[$i]);
}
- $cnt_sql = sprintf("UPDATE %susers SET (game_cnt)
- = (game_cnt+1) WHERE %s;",
+ /* pg10+: single column without parentheses, see user_update_login_time().
+ The one above is multi column and stays valid. */
+ $cnt_sql = sprintf("UPDATE %susers SET game_cnt
+ = game_cnt+1 WHERE %s;",
$G_dbpfx, $codes_where);
error_log($cnt_sql);
if (($cnt_pg = $this->query($cnt_sql)) == FALSE || pg_affected_rows($cnt_pg) != $n) {