News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

updated to 2.02 and getting this error...

Started by DarkAngel612, March 22, 2012, 04:02:46 AM

Previous topic - Next topic

DarkAngel612

PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/xxxx/public_html/xxxxx/Sources/Subs-Db-mysql.php on line 132

I found the other threads from last year but was wondering if there is something new to do or an idea what is happening?

I am also showing this error to be in effect since [09-Mar-2012 08:32:09]

The above message appears over and over with [21-Mar-2012 22:40:11] appearing to be the last entry---have disabled the sites error log to see if a new one generates again with this error and as for admin/error log the only entries are for an undefined error:

http://thefantasiesattic.net/attic/index.php?board=350.0;nowap

8: Undefined index: costa_topico_normal
File: Themes/chemical/MessageIndex.template.php
Line: 237

8: Undefined index: costa_topico_fixo
File: Themes/chemical/MessageIndex.template.php
Line: 226

which the other forums (1 test 1 live) that have this theme do not have this error or the other one, just our main forum.

Apache version      2.2.17
PHP version     5.2.17
MySQL version     5.0.95-community
Architecture     x86_64
Operating system     linux
Perl version     5.8.8
Kernel version     2.6.18-028stab089.1


SMF 2.02

Mods:

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Kermit

Those undefined index errors have something to do with one of your installed modifications,to be more specific

http://custom.simplemachines.org/mods/index.php?action=parse;mod=3300;attach=195226;smf_version=2.0.2

you can check the coding,apparently the mod was not completely uninstalled,so you can remove the rest code manually

and regarding the first error,i don't know how to fix it
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

DarkAngel612

Quote from: Kermit on March 22, 2012, 04:50:59 AM
Those undefined index errors have something to do with one of your installed modifications,to be more specific

http://custom.simplemachines.org/mods/index.php?action=parse;mod=3300;attach=195226;smf_version=2.0.2

you can check the coding,apparently the mod was not completely uninstalled,so you can remove the rest code manually

and regarding the first error,i don't know how to fix it

I am so sorry I should have been more specific...that 2nd error is not from a mod, it is from something that is not set in the language file for the Chemical theme.

But thanks anyway I will need to contact the creator -- runic -- for an answer


however, I am going to check the coding too even though I do not have that particular mod installed.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Kermit

Nope,those strings have nothing to do with a theme,they belong to that mod which i have linked,just you need to check the codes manually
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

DarkAngel612

Quote from: Kermit on March 22, 2012, 07:22:11 AM
Nope,those strings have nothing to do with a theme,they belong to that mod which i have linked,just you need to check the codes manually

ok will do even if it never has been installed...lol
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

DarkAngel612

Weird cause the sticky topics are in adifferent color than the regular ones---I have never used that mod so did not know it existed...lol

I went into the theme and changed its message file then went into default language file and added the info there and it would seem the error has gone away.

Thanks


but the one:

[22-Mar-2012 07:56:48] PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/tttttttt/public_html/ttttt/Sources/Subs-Db-mysql.php on line 132

still fills up the error log
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Shambles

No so sure it's a wise idea to completely change the topic title when part of your issue has been solved; makes it tough to keep track of things  ::)

DarkAngel612

Quote from: Shambles on March 22, 2012, 05:10:01 PM
No so sure it's a wise idea to completely change the topic title when part of your issue has been solved; makes it tough to keep track of things  ::)

sorry but figured it might get more help drawn in here will put it back
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal


DarkAngel612

How weird is it????

I did the edits for the theme problem, waited to see if error would return---deleted the error log off server---

no error log that error that overpopulated the log is now gone...no error log, no error, happy forum

Not sure how/why that theme error would make the other error but it sure seems to be the case.

I had read that one before making my own thread and it made absolutely no sense to me at the time--headache with weather lately---raining for 3 or 4 days and my head no like...lol

Thanks for help...I am sure to come back with something else.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

You'll be most welcome! :)

Glad you're sorted.

DarkAngel612

Well folks that primary error filling up the logs is back. Seems it came back around the 23rd of this month and like the other time seems it is along with either undefined text or other errors like these:

[23-Mar-2012 18:01:04] PHP Notice:  Undefined index:  server in /home/tttt/public_html/ttt/Sources/Subs-Post.php on line 622
[23-Mar-2012 18:01:04] PHP Notice:  Undefined index:  utf8 in /home/ttt/public_html/tttt/Sources/Subs-Post.php on line 1257
[23-Mar-2012 18:01:04] PHP Notice:  Undefined index:  utf8 in /home/tttt/public_html/tttt/Sources/Subs-Post.php on line 1259
[23-Mar-2012 18:01:04] PHP Notice:  Undefined index:  server in /home/tttt/public_html/tttt/Sources/Subs-Post.php on line 1279

[23-Mar-2012 18:01:04] PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Compilation failed: invalid UTF-8 string at offset 8 in /home/xxxx/public_html/xxx/Sources/Subs-Post.php on line 1279

[24-Mar-2012 18:47:48] PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/xxxx/public_html/xxxx/Sources/Subs-Db-mysql.php on line 132




There was also an undefined $txt and language error for the subs-post.php file where I just to test...replaced the $txt with $text and thus far the error seems to be gone again....but who knows for how long.

Therefore I have removed the solved part of this thread....and it seems geared to being on  a shared server but i am on a VPS for our sites and only one forum gets this pile of errors:

PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/xxxx/public_html/xxxxx/Sources/Subs-Db-mysql.php on line 132

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

I have a hunch about that last error...

Does your host still use v4 of PHP?

DarkAngel612

Quote from: K@ on March 30, 2012, 05:13:29 AM
I have a hunch about that last error...

Does your host still use v4 of PHP?


Nope

PHP version5.2.17
MySQL version5.0.95-community
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

In your copy of the file, is line 132 this?

return sprintf('\'%1$s\'', mysql_real_escape_string($replacement, $connection));

DarkAngel612

Quote from: K@ on March 31, 2012, 09:52:52 AM
In your copy of the file, is line 132 this?

         return sprintf('\'%1$s\'', mysql_real_escape_string($replacement, $connection));



First your answer...lol   Yes it is

I have also noticed that this forum with its problems is the only one to have them. The others have the exact same files in sources but the errors are not in them.

I keep getting undefined index this or that or undefined text days apart but usually with the subs-post file

so far this one:

[30-Mar-2012 18:01:04] PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Compilation failed: invalid UTF-8 string at offset 8 in /home/xxxx/public_html/xxx/Sources/Subs-Post.php on line 1279

has not returned yet...I compared the code from the 2.0.2 file:

// Convert all 'special' characters to HTML entities.
        return array($charset, preg_replace('~([\x80-' . ($context['server']['complex_preg_chars'] ? '\x{10FFFF}' : "\xF7\xBF\xBF\xBF") . '])~eu', '$entityConvert(\'\1\')', $string), '7bit');
    }


to the this one

// Convert all 'special' characters to HTML entities.
        return array($charset, preg_replace('~([\x80-' . ($context['server']['complex_preg_chars'] ? '\x{10FFFF}' : pack('C*', 0xF7, 0xBF, 0xBF, 0xBF)) . '])~eu', '$entityConvert(\'\1\')', $string), '7bit');
    }


the part being in red as the difference...I changed my file on the server to it and the error has not come back...yet

while writing this I scoured the files and I guess I got lost in folders...that code came from 1.1.9 version file...I hope I did not hurt anything with the edit I did to remove the 2.0.2 code and replace with that one.

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat


DarkAngel612

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

WoOt!

Tell ya what. I'll mark this "Solved", right now.

DARE it to return.... ;)

DarkAngel612

#19
it took you up on the dare.....GRRRR

I have no troubles sending --- getting emails nor notifications to folks but that darn subs one for the mysql file in sources is procreating proficiently right now along with a couple of new ones...



PHP Warning:  mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in /home/thefanta/public_html/attic/Sources/Subs-Db-mysql.php on line 368

PHP Warning:  mysql_error(): supplied argument is not a valid MySQL-Link resource in Sources/Subs-Db-mysql.php on line 414

PHP Warning:  mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/thefanta/public_html/attic/Sources/Subs-Db-mysql.php on line 415

PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /Sources/Subs-Db-mysql.php on line 132

PHP Fatal error:  Cannot use string offset as an array in Themes/default/Wireless.template.php on line 1516



the only errors in the admin side of the forum are just general alerts of spammers attempting to access but access is denied them.

so the one for the subs-post file is behaving but still the other one lingers.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

I've unsolved the topic, again. :(

I'm beginning to wonder, here, if there's something weird going on with your host.

I know having mod_security enabled can be a pain in the arse. But, I don't know if that could be causing these hassles.

Can you check, even if it's just to rule that out?

DarkAngel612

#21
host is hostgator

we have a vps with all our forums there

each has its own ip but only this one with all the mods I have installed (the others have some of them)

see images of packages installed for this forum, subforum, other forum and store forum
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

Which of those is the fanta one that's throwing errors?

DarkAngel612

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

I guess we'd better take a look at Subs-Db-mysql.php.

I doubt there's anything wrong with it, though. :(

DarkAngel612

here you go, cuase today there are more of the same error....multiplies like a bunny couple
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

Nothing wrong with that.

OK. I'm now even more confused than you are. :(

Problem I have, is that I really don't know much about VPS stuff and how it's configured.

DarkAngel612

you got me...I used it and upload to it and set up some stuff but real novice here and it is managed for me by hostgator

and since yesterdays error log with the multiple listings of its ine, over and over....then the admin section telling me of som more undefined stuffies...I fixed it for those...seems the mod for child drop down menu has its own language file and the software did not really recognize it so I just took what was in it and put it into the default languages index file and so far no more of that obnoxious error.

Also updated my Tiny Portal to the newer version that just came out a the other day to correct a block issue and again still no more replicating error log on server.

Wonder how long it will be gone this time. I am trying to see if it appears after software wants to see something (undefined item) and then maybe see a pattern in this sporadic thing.

Thanks for trying cause many have thought it was something to do with hostgator but it has happened to others that do not have them for host...also on shared as well as VPS and no real mod narrowed down either....just a weird persistent gremlin.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat


DarkAngel612

well the error about
Sources/Subs-Post.php on line 1279 came back today so I reverted to the original text for that area again.

still getting that procreating error now  same lines in the subs-db-mysql.php file --- lines 132

and for the subs-post file lines 1257, 1259, 1279 (that is the one I reverted to its original code now0

the other two are dealing with convertinng all special characters to html entities...just for hotmail.


still can't figure out why this is the only forum with the error log and none of the other 4 forums

Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal


DarkAngel612

PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/xxxx/public_html/xxxxx/Sources/Subs-Db-mysql.php on line 132
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal


DarkAngel612

Yes read that one and the other one from beginning to end but they all seem to be talking of one site on one server with one host.

I have 2 forums, 2 subs on one vps with one host and only 1 of the silly forums is acting up so their solution was not very helpful...and got no such error until going to 2.0--for the naughty forum. Oh I also have a test forum on another server/host and it behaves too.

I thought maybe something went wrong...this forum is the one that did not take the 1.1.9 version update very well not to mention the 2.0.2 either soooooo

once more I uninstalled all the mods, got rid of 2 themes (they were not used and one of them may have been contributor to the posts probable answer--it had googles analytical code when I already have it in all the forums)

removed totally all of the files for 2.0.2 then reupped them, installed my Tiny Portal again.

The only error was for the lines about the separate colors for the sticky/locked topics....which I do not have that mod installed but it must come with SMF automatically since it was there from the onset. those topics are slightly darker than the rest of topics.

Anyway any error in admin would pop that one for mysql to pop up and it also kept tossing errors every so often about undefined text and such -- which the others do not --

so that was done about 11:30 pm and so far no error in server about mysql so fingers are crossed that it was just something mucked with the files from the get go.

we shall see how long that stays that way...thanks for your patience and help
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

It's been a bit like one of the Sherlock Holmes plots, trying to nail this one down, innit?

Fingers and other sundry bits crossed....

DarkAngel612

well like the man falling from the plane said: so far so good

no error log filled with the error message has shown up and in admin only the perverbial "this person is a spammer, please alert administration" so all appears to be ok...will give it til end of week to see if that gremlin comes back.

will let you guys know if that helped or if it just is determined to appear again.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

DarkAngel612

well here is the next batch of errors...the very first one set the mysql error to create itself later on over and over again: I have also included the coding for the section with the line in red.

[15-Apr-2012 03:33:08] PHP Warning:  POST Content-Length of 30739448 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

No clue to what needs done or where to look...it may have sprouted from a member going over the post box limit in shout box (TinyPortal)



[15-Apr-2012 17:32:53] PHP Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in .../Sources/Subs-Db-mysql.php on line 132


    case 'string':
        case 'text':
            return sprintf('\'%1$s\'', mysql_real_escape_string($replacement, $connection));
        break;




[15-Apr-2012 18:59:18] PHP Warning:  mysql_error(): supplied argument is not a valid MySQL-Link resource in .../Sources/Subs-Db-mysql.php on line 414


[15-Apr-2012 18:59:18] PHP Warning:  mysql_errno(): supplied argument is not a valid MySQL-Link resource in .../Sources/Subs-Db-mysql.php on line 415


// This is the error message...
    $query_error = mysql_error($connection);    $query_errno = mysql_errno($connection);




[15-Apr-2012 18:59:18] PHP Warning:  mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in .../Sources/Subs-Db-mysql.php on line 368

    // Debugging.
    if (isset($db_show_debug) && $db_show_debug === true)
        $db_cache[$db_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st));

    return $ret;
}

function smf_db_affected_rows($connection = null)
{
    global $db_connection;

    return mysql_affected_rows($connection == null ? $db_connection : $connection);}

function smf_db_insert_id($table, $field = null, $connection = null)
{
    global $db_connection, $db_prefix;

    $table = str_replace('{db_prefix}', $db_prefix, $table);

    // MySQL doesn't need the table or field information.
    return mysql_insert_id($connection == null ? $db_connection : $connection);
}


[/color]
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

I seem to remember Arantor helping someone out, with that error, a while back.

Is there something on your forum that could be hammering at the database, slowing it down?

Is your hosting-package kinda "Cheap'n'cheerful"?

DarkAngel612

I read the other two threads concerning the problem, there was nothing really in them that rally had much to do with this.

It mentioned being on a shared server...I have a VPS and no not cheap...lol

I also have 4 forums with the same version, almost the same mods and set up the same with themes too.

Host is Hostgator and they went thru the server settings with a fine tooth come and found nothing going on. They set some kind of setting about logging slow queries?? not sure what exactly but after a few days turned it off cause it did nothing.

Finally they said they think there must be a bug playing about in smf
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

I may have already asked this...

What version of PHP do you have on the server?

Could it be either a bit old or a bit new?

(I'm fishing, here, as you may have noticed) ;)

DarkAngel612

Quote from: K@ on April 17, 2012, 06:05:43 AM
I may have already asked this...

What version of PHP do you have on the server?

Could it be either a bit old or a bit new?

(I'm fishing, here, as you may have noticed) ;)

PHP: 5.2.17
Apache: 2.2.17
MySQL: 5.0.95-community with localhost via UNIX socket <-- from myPHPadmin page
MySQL client version: 4.1.22
Operating System is Linux

They have recently update c-panel too

mods installed:
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

MrPhil

Looking through the code in Sources/Subs-db-mysql.php, I see something odd. In most functions, $connection is an optional parameter, with a default value of null. If null, the $db_connection global is used instead. In smf_db_error(), $db_connection is (re)set to the output of mysql_[p]connect(), but if it comes back null (call failed), it gets set to false. That must be where the "is a boolean" error message is coming from.

It would appear to me, based on this admittedly brief examination, that sometimes database error handling is leaving the connection ($db_connection) as false instead of null or a valid connection value. Just a thought, but anyone having chronic troubles with "second parameter expected to be a resource, but is a boolean" might try changing the $db_connection = false; to $db_connection = null; and report back whether matters improved.

If the intent was to kill the whole database connection due to unrecoverable errors, it probably could have been handled better. At the least, the code setting $db_connection to false should have been commented as to what's going on, and perhaps a message to the user!

kat

[Beach Boys mode]

Oh, wouldn't it be nice!

[/Beach Boys mode]

DarkAngel612

I forgot to add that I had a full error_log yesterday and today so far not a single error_log shows up.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

DarkAngel612

well that stupid mysql error is back almost daily again and am wondering if it is a c-panel thing with the latest upgrade many hosts have done to c-panel everywhere.

I did get a notice that there is a version of c-panel that is not going to final as yet---they thought it would be soon but changed their minds--due to a bug...really a bug??? wonder what set them a clue...lol

I hate gremlin bugs they are so hard to pinpoint.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

Apologies for not reading this whole thread through. You may have already answered this...

Are you on shared hosting?

If you are, it could be that the sever's getting hammered by someone else and you're suffering, as a result of that.

DarkAngel612

all our forums are on our VPS server...and only this forum is misbehaving
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

Bugger. I remember you saying that, now. Poo.

I'm out of ideas. Could one of those other installations be hammering the server, in some way?

Shoutbox set to "Real time", Chat room?

DarkAngel612

shoutbox is thru TP and has been there forever , security mods also were in place prior to 2.0. the security mods are on all the forums as they have been  so the others should also be having this error issue but nope only this forum is.

tis weird but I will just continue deleting the file and let it do its thing. nothing is going on with the forum...**sighs**
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

On my forum, I have error-reporting disabled. ;)


SMF Arcade...

DarkAngel612

you mean the setting in admin for that error log area?

do you think that may stop the error_log on the server, which is where it shows up and never in the admin section?
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

kat

Ah. No, I think that'll keep chugging away. I believe that that's totally independent of SMF.

That makes me wonder, though. Is there anything in the SMF error-log that might give us any clues about this?

DarkAngel612

just undefined this or that is all that is ever there and also telling me that this user or that one is considered a spammer and to notify administrator. other than that nothing else.
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

TheListener

Quote from: DarkAngel612 on April 23, 2012, 10:38:40 PM
just undefined this or that is all that is ever there and also telling me that this user or that one is considered a spammer and to notify administrator. other than that nothing else.

Are you able to copy some of the errors and post them within a quote code?

DarkAngel612

From earlier in the month:

PHP Notice:  Undefined index:  server in /home/thefanta/public_html/attic/Sources/Subs-Post.php on line 622

PHP Notice:  Undefined index:  utf8 in /home/thefanta/public_html/attic/Sources/Subs-Post.php on line 1257

PHP Notice:  Undefined index:  utf8 in /home/thefanta/public_html/attic/Sources/Subs-Post.php on line 1259

PHP Notice:  Undefined index:  server in /home/thefanta/public_html/attic/Sources/Subs-Post.php on line 1279

PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Compilation failed: invalid UTF-8 string at offset 8 in /home/thefanta/public_html/attic/Sources/Subs-Post.php on line 1279

PHP Fatal error:  Cannot use string offset as an array in /home/thefanta/public_html/attic/Themes/default/Wireless.template.php on line 1516



today's error and for the record---no huge error_log on server with mysql taken over it either...lol

8: Undefined variable: settings
File: /home/thefanta/public_html/attic/Themes/default/TPsubs.template.php(114) : eval()'d code
Line: 47

8: Undefined variable: settings
File: /home/thefanta/public_html/attic/Themes/default/TPsubs.template.php(114) : eval()'d code
Line: 47



I also have disable template on but I think for some reason it does not behave and the mod no longer works for installing it either
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

MrPhil

Those "undefined index" errors have shown up a number of other times, usually associated with Simple Portal. Have you posted on your portal's (TP?) support thread?

DarkAngel612

yuppers but why this forum only and when before 2.0 I used it then too 5+ yrs with no problems

2.0 just being really mean to me with this forum and not the others on our server...lol
Fantasy Attic ::  Fantasies Realm Market :: SMF 2.0+ with various mods and TinyPortal

Advertisement: