News:

Wondering if this will always be free?  See why free is better.

Main Menu

Bug in Subs-Post.php since update to 2.0.14

Started by SMiFFER, June 10, 2017, 03:12:14 AM

Previous topic - Next topic

SMiFFER

All I changed lately was to update to 2.0.14,
and since that very day (in fact only 30mins after that) my error log started to get cluttered with this error:

2: mysql_num_rows() expects parameter 1 to be resource, object given
File: ....../Sources/Subs-Post.php
Line: 1601

Is this a known bug?
If so then feel free to merge my post there.

Is there a fix?

Best regards!
Quote of the day: A troll is an obstinate bloke who only hungers for your attention. If you feed him, he will puke all over you!

Shambles

Your line 1601 may be different to everyone else's line 1601.

What's the code around that line? Doesn't look like standard/issued SMF and as you haven't listed your modifications it's going to be a tough diagnosis.

Arantor

You shouldn't be using a bare mysql_num_rows call, whatever mod you have needs to actually do it properly and use $smcFunc['db_num_rows'] instead.

SMiFFER

Quote from: Shambles on June 10, 2017, 04:20:52 AM
Your line 1601 may be different to everyone else's line 1601.

What's the code around that line?

Does it help when I quote you the lines of Subs.php or do you want the entire file attached?
EDiT: I found out just now that I cannot attach the entire file because of restrictions.
These are the lines 1580-1619:

array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_link" target="_blank">',
'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),
array(
'tag' => 'white',
'before' => '<span style="color: white;" class="bbc_color">',
'after' => '</span>',
),
);

// Let mods add new BBC without hassle.
call_integration_hook('integrate_bbc_codes', array(&$codes));

// This is mainly for the bbc manager, so it's easy to add tags above.  Custom BBC should be added above this line.
if ($message === false)
{
if (isset($temp_bbc))
$bbc_codes = $temp_bbc;
return $codes;
}
Quote of the day: A troll is an obstinate bloke who only hungers for your attention. If you feed him, he will puke all over you!

SMiFFER

Quote from: Shambles on June 10, 2017, 04:20:52 AM
...and as you haven't listed your modifications it's going to be a tough diagnosis.

I do now:

1. SMF 2.0.12 Update 1.0 [ List Files ] [ Delete ]
2. Signature Option Post 1.1.1 [ Uninstall ] [ List Files ] [ Delete ]
3. Better Profile Menu 2.4 [ Uninstall ] [ List Files ] [ Delete ]
4. Activity Bar 1.1 [ Uninstall ] [ List Files ] [ Delete ]
5. Sorted BBCode List for SMF 2.0.x 1.1 [ Uninstall ] [ List Files ] [ Delete ]
6. Global Topics 2.2 [ Uninstall ] [ List Files ] [ Delete ]
7. Unknown Actions 1.2 [ Uninstall ] [ List Files ] [ Delete ]
8. SimpleColorizer 1.1 [ Install Mod ] [ List Files ] [ Delete ]
9. Admin Notepad 2.0.2 [ Uninstall ] [ List Files ] [ Delete ]
10. Display Signatures Only Once Per Page 1.0.3 [ Uninstall ] [ List Files ] [ Delete ]
11. Hide ip stuff for users 1.05 [ Uninstall ] [ List Files ] [ Delete ]
12. Activity in Profile 1.1 [ Uninstall ] [ List Files ] [ Delete ]
13. Indent BBC 1.0.1 [ Uninstall ] [ List Files ] [ Delete ]
14. Alternate User Posting 1.0.1 [ Uninstall ] [ List Files ] [ Delete ]
15. Last Active On MemberList 1.4 [ Uninstall ] [ List Files ] [ Delete ]
16. Tidy Child Boards 2.0 [ Uninstall ] [ List Files ] [ Delete ]
17. Lazy Admin Menu 2.3 [ Uninstall ] [ List Files ] [ Delete ]
18. SMF Mailing List Mod 2.03 [ Uninstall ] [ List Files ] [ Delete ]
19. Redirection Topics 1.0.3 [ Uninstall ] [ List Files ] [ Delete ]
20. Post History 1.03 [ Uninstall ] [ List Files ] [ Delete ]
21. Join Reason 1.5 [ Uninstall ] [ List Files ] [ Delete ]
22. Personal Messages to Membergroups 1.4.3 [ List Files ] [ Delete ]
23. SMF 2.0.13 Update 1.0 [ List Files ] [ Delete ]
24. SMF Notify Group 2.2 [ Uninstall ] [ List Files ] [ Delete ]
25. Expanding & Collapsing Spoiler Tag 3.2 [ Uninstall ] [ List Files ] [ Delete ]
26. Voter Visibility 2.1 [ Uninstall ] [ List Files ] [ Delete ]
27. SMF 2.0.14 Update 1.0 [ Uninstall ] [ List Files ] [ Delete ]
Quote of the day: A troll is an obstinate bloke who only hungers for your attention. If you feed him, he will puke all over you!

SMiFFER

What irritates me most is that (count it, you will agree) the line that is reported as errorneous (Line 1601) is just this:
),
Quote of the day: A troll is an obstinate bloke who only hungers for your attention. If you feed him, he will puke all over you!

Arantor

Weird, I don't see a MySQL call in there.

The line number is always the closing line of the statement it is related to, since a single call can easily spread over multiple lines.

But it looks like a mod has been installed or uninstalled since this error first occurred since for the snippet shown it is literally not possible for it to generate that error.

SMiFFER

#7
See this screenshot:

Quote of the day: A troll is an obstinate bloke who only hungers for your attention. If you feed him, he will puke all over you!

Shambles

What you quoted in reply #3 is from Subs.php not Subs-Post.php

SMiFFER

Thanks. Did not see that first.

I have corrected that mistake of mine and posted a screenshot.
Quote of the day: A troll is an obstinate bloke who only hungers for your attention. If you feed him, he will puke all over you!

Shambles

Well that statement ought to be coded as

if($smcFunc['db_num_rows']($acheck) > 0) {

Advertisement: