Skip to main content
Topic: Two RSS errors: mysqli_free_result() and mysqli_num_rows() (Read 4736 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Two RSS errors: mysqli_free_result() and mysqli_num_rows()

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
Code: [Select]
2: mysqli_free_result() expects parameter 1 to be mysqli_result, null given
File: /sources/database/Db-mysql.class.php
Line: 543
Code: [Select]
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
Code: [Select]
2: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given
File: /sources/database/Db-mysql.class.php
Line: 554
Code: [Select]
551:		public function num_rows($result)
552: {
553: // Simply delegate to the native function
==>554: return mysqli_num_rows($result);
555: }

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #1

hmm...

Can you see a "pattern"?
Maybe only registered members of some kind?
Or just guests?
Or something else?
Bugs creator.
Features destroyer.
Template killer.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #2

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.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #3

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.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #4

No, this are only errors related to DB, I don't have any other errors.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #5

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...
Bugs creator.
Features destroyer.
Template killer.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #6

Sure, I'll do it today.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #7

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

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #8

oh... yes, you are right... :-[
Bugs creator.
Features destroyer.
Template killer.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #9

@phantom did the error appear again?
Bugs creator.
Features destroyer.
Template killer.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #10

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.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #11

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.
Bugs creator.
Features destroyer.
Template killer.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #12

like a
Code: [Select]
if (mysqli_ping($connection))
  ....

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #13

I was more thinking about something like:
Code: [Select]
	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:-)
Bugs creator.
Features destroyer.
Template killer.

Re: Two RSS errors: mysqli_free_result() and mysqli_num_rows()

Reply #14

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?