Avatar

Update from 2.4.20 to 20220803.1 failed, two issues so far (Bugs)

by Auge ⌂, Monday, September 19, 2022, 09:19 (16 days ago) @ Nico Hoffmann

Hello

Well, the next try :-)

As first: Thank you for your unintentionally tests.

my provider offered a transfer to a new database with MYSQL 5.7 (also possible MYSQL 8, or MariaDB 10.6) and I tried the update. I got these errors:


Fehler!

Database error in line 363: Incorrect datetime value: '0000-00-00 00:00:00' for column 'edited' at row 1
Database error in line 378: Incorrect date value: '0000-00-00' for column 'birthday' at row 1
Database error in line 381: Incorrect date value: '0000-00-00' for column 'birthday' at row 1

That's the pitfalls of the configuration dependent, possible lax data model of MySQL and the default values for columns that was mostly set by Alex years ago (possibly wíthout the necessary knowledge about the corner cases, i.e. much more stringent configurations of MySQL-servers).

The forum itself seems to run, however it shown ugly PHP warnings:


Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /PATH/includes/main.inc.php on line 259

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /PATH/forum/includes/main.inc.php on line 260

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /PATH/forum/includes/main.inc.php on line 262

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /PATH/forum/includes/main.inc.php on line 263

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /PATH/forum/includes/main.inc.php on line 267

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /PATH/forum/includes/main.inc.php on line 268

Hmmm, the error in line 259 is the cause of the following errors. This is the complete block in main.inc.php (version 20220803.1).


259 | $count_result = mysqli_query($connid, "SELECT COUNT(*) FROM " . $db_settings['userdata_table'] . " WHERE activate_code = ''");
260 | list($registered_users) = mysqli_fetch_row($count_result);
261 |
262 | if ($settings['count_users_online'] > 0) {
263 |  user_online($settings['count_users_online']);
264 |  $count_result = mysqli_query($connid, "SELECT COUNT(*) FROM ".$db_settings['useronline_table']." WHERE user_id > 0");
265 |  list($registered_users_online) = mysqli_fetch_row($count_result);
266 |  $count_result = mysqli_query($connid, "SELECT COUNT(*) FROM ".$db_settings['useronline_table']." WHERE user_id = 0");
267 |  list($unregistered_users_online) = mysqli_fetch_row($count_result);
268 |  $total_users_online = $unregistered_users_online + $registered_users_online;
269 | }
270 | mysqli_free_result($count_result);

But comparing the line numbers in your error messages with the code one can see, that the messages reports MySQL-errors in lines, where we don't see MySQL-related function calls in the code of version 20220803.1 (as shown above). But when we look into the code of version 2.4.20 (the version from where you started the update) we can see MySQL-related code with a query, that includes columns that are gone with version 2.5. The gone colum is part of the string in the variable $display_spam_query_and, that was generated in the previous block, beginning with line #239.


256 | } else {
257 |  // there are categories
258 |  $count_result = mysqli_query($connid, "SELECT COUNT(*) FROM ".$db_settings['forum_table']." WHERE pid = 0".$display_spam_query_and." AND category IN (".$category_ids_query.")");
259 |  list($total_threads) = mysqli_fetch_row($count_result);
260 |  mysqli_free_result($count_result);
261 |  $count_result = mysqli_query($connid, "SELECT COUNT(*) FROM ".$db_settings['forum_table']." WHERE category IN (".$category_ids_query.")".$display_spam_query_and);
262 |  list($total_postings) = mysqli_fetch_row($count_result);
263 |  mysqli_free_result($count_result);
264 | }
265 | // count spam:
266 | $count_spam_result = mysqli_query($connid, "SELECT COUNT(*) FROM ".$db_settings['forum_table']." WHERE spam = 1");
267 | list($total_spam) = mysqli_fetch_row($count_spam_result);
268 | mysqli_free_result($count_spam_result);

That said, we have to assume, that you forgot to upload the script file(s) (at least the main.inc.php).


Warning: Cannot modify header information - headers already sent by (output started at /PATH/forum/includes/main.inc.php:259) in /PATH/forum/index.php on line 208

Warning: Cannot modify header information - headers already sent by (output started at /PATH/forum/includes/main.inc.php:259) in /PATH/forum/index.php on line 209

These are subsequent errors because of the output of the previous error messages. This errors would not occur, if the error in main.inc.php, line 259 would not happen.

remarks:

- Before the update attempt today the forum was O.K., but I did a similar try two weeks ago. I cannot confirm that this try did not touch the databases. However this should be unlikely.
- In the "entries" table there are entries with "0000-00-00 00:00:00" in the edited row.
- in the "uderdata" table there are entries with "0000-00-00" in the borthday row.

Should I set these entries to NULL manually before updating?

Generally this is a proper idea, but I cannot recommend this without knowing the possible side effects (i.e. when a function relies on the format (0000-00-00 (00:00:00)) and does not take a NULL value into account). There are many more places in the database, where setting the default values to NULL would make IMHO much more sense than the current defaults does.

Any suggestions?

I had a few looks into the code of the update script and I have ideas to improve the script without breaking updates, that have aready been made. I will inspect the code with a focus on the date and datetime topics today and will give a report today in the evening or tomorrow.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread