Advertisement:

Author Topic: Bug in Subs-Post.php since update to 2.0.14  (Read 1969 times)

Offline SMiFFER

  • Jr. Member
  • **
  • Posts: 222
Bug in Subs-Post.php since update to 2.0.14
« on: June 10, 2017, 03:12:14 AM »
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!
...coming from VB, using SMF since 2012, now hosting it myself
currently 2.0.15

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,511
  • Gender: Male
    • i30 Owners Club
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #1 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? Doesn't look like standard/issued SMF and as you haven't listed your modifications it's going to be a tough diagnosis.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,051
    • Arantor on GitHub
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #2 on: June 10, 2017, 07:05:26 AM »
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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline SMiFFER

  • Jr. Member
  • **
  • Posts: 222
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #3 on: June 18, 2017, 01:24:57 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:

Code: [Select]
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;
}
...coming from VB, using SMF since 2012, now hosting it myself
currently 2.0.15

Offline SMiFFER

  • Jr. Member
  • **
  • Posts: 222
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #4 on: June 18, 2017, 01:29:19 AM »
...and as you haven't listed your modifications it's going to be a tough diagnosis.

I do now:

Code: [Select]
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 ]
...coming from VB, using SMF since 2012, now hosting it myself
currently 2.0.15

Offline SMiFFER

  • Jr. Member
  • **
  • Posts: 222
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #5 on: June 18, 2017, 01:30:25 AM »
What irritates me most is that (count it, you will agree) the line that is reported as errorneous (Line 1601) is just this:
Code: [Select]
),
...coming from VB, using SMF since 2012, now hosting it myself
currently 2.0.15

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,051
    • Arantor on GitHub
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #6 on: June 18, 2017, 03:09:29 AM »
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.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline SMiFFER

  • Jr. Member
  • **
  • Posts: 222
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #7 on: June 23, 2017, 11:01:04 AM »
See this screenshot:

« Last Edit: June 23, 2017, 11:24:51 AM by SMiFFER »
...coming from VB, using SMF since 2012, now hosting it myself
currently 2.0.15

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,511
  • Gender: Male
    • i30 Owners Club
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #8 on: June 23, 2017, 11:14:20 AM »
What you quoted in reply #3 is from Subs.php not Subs-Post.php

Offline SMiFFER

  • Jr. Member
  • **
  • Posts: 222
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #9 on: June 23, 2017, 11:23:25 AM »
Thanks. Did not see that first.

I have corrected that mistake of mine and posted a screenshot.
...coming from VB, using SMF since 2012, now hosting it myself
currently 2.0.15

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,511
  • Gender: Male
    • i30 Owners Club
Re: Bug in Subs-Post.php since update to 2.0.14
« Reply #10 on: June 23, 2017, 11:34:56 AM »
Well that statement ought to be coded as

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