I'm reporting it here, because I have nothing installed (just clean ElkArte 1.0).
RSS is working fine for me, but from some time I see in error log this two entries:
URL: index.php?action=.xml;type=atom;limit=5
2: mysqli_free_result() expects parameter 1 to be mysqli_result, null given
File: /sources/database/Db-mysql.class.php
Line: 543
540: public function free_result($result)
541: {
542: // Just delegate to MySQL's function
==>543: mysqli_free_result($result);
544: }
URL: index.php?action=.xml;type=atom;limit=5
2: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given
File: /sources/database/Db-mysql.class.php
Line: 554
551: public function num_rows($result)
552: {
553: // Simply delegate to the native function
==>554: return mysqli_num_rows($result);
555: }
hmm...
Can you see a "pattern"?
Maybe only registered members of some kind?
Or just guests?
Or something else?
It was once generated by me and once by Guest, but I think that it was me anyway, because I set up RSS feed in my browser.
This is an odd one. Are there any other db errors before those errors? For the result object to be null it would seem like the db connection is gone.
No, this are only errors related to DB, I don't have any other errors.
Judging from the errors, I think it can happen only here:
https://github.com/elkarte/Elkarte/blob/v1.0.0/sources/subs/News.subs.php#L206
that is a function that has both free_result and num_rows.
The function grab the messages of the feeds.
That's quote an odd error.
Could you try removing the "@" before mysqli_query in Db-mysql.class.php, query method?
If there is an error that should expose it a little bit better...
Sure, I'll do it today.
I thought it might be this function (recent posts), its almost the same as the above
https://github.com/elkarte/Elkarte/blob/v1.0.0/sources/subs/News.subs.php#L275
Either way, remove the suppression from that as well to see if we get more information, I guess a broken query with @ suppression may return a null response
oh... yes, you are right... :-[
@phantom did the error appear again?
So far I have no new entries in error log, but it's important to add that host updated server and it's running new version of MySQL.
Before it was 5.0.92-log and now I have 5.5.38-35.2-log.
Well, if nothing else appears it's difficult to investigate.
Anyway, I wonder if it is worth adding a check just before using the mysqli_* functions to be sure the resource passed is actually a resource or not.
like a
if (mysqli_ping($connection))
....
I was more thinking about something like:
public function free_result($result)
{
if (!is_object($result))
return false;
// Just delegate to MySQL's function
mysqli_free_result($result);
}
[...]
public function num_rows($result)
{
if (!is_object($result))
return false;
// Simply delegate to the native function
return mysqli_num_rows($result);
}
O:-)
Thats a cheat :P We could just for empty on the result and that makes some sense ... but why is it getting passed a null to begin with, any ideas?
Apparently the error didn't popup any more, so not having more info I guess it's not possible to find a meaningful fix. ;)