Author |
Message |
selectric
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/Winnie_The_Pooh/Winnie_The_Pooh_-_Pooh.gif)
Joined: Aug 06, 2008
Posts: 65
|
Posted:
Mon Apr 13, 2009 1:14 pm |
|
Hello! Thanks for your time in reading this post...
I am suddenly getting getting the following error code log:
Code:
[Sun Apr 12 14:04:24 2009] [error] [client *********] PHP Warning: mktime() expects parameter 1 to be long, string given in /html/modules/Homepage/index.php on line 266
|
Here is the time code I am using:
Code:$time = $myrow['time'];
formatTimestamp($time);
setlocale(LC_TIME, $locale);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime2);
$datetime2 = strftime(""._DATESTRING2."", mktime($datetime2[4],$datetime2[5],$datetime2[6],$datetime2[2],$datetime2[3],$datetime2[1]));
$datetime2 = ucfirst($datetime2);
|
Line 266 is:
Code:$datetime2 = strftime(""._DATESTRING2."", mktime($datetime2[4],$datetime2[5],$datetime2[6],$datetime2[2],$datetime2[3],$datetime2[1]));
|
Does anyone know what the problem is? I have been using this code for years now.
Thanks! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
bluerace
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Apr 04, 2009
Posts: 85
Location: Behind you
|
Posted:
Mon Apr 13, 2009 2:21 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
selectric
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Apr 13, 2009 2:30 pm |
|
Hey thanks alot for writing up a post about it! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
Site Admin
![](modules/Forums/images/avatars/125904890252d880f79f312.png)
Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Fri May 08, 2009 9:47 am |
|
Says module is not active at that link |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
bluerace
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri May 08, 2009 11:32 am |
|
Sorry, Guardian2003.
The module does not work becaus the whole BB board was replaced with final phpBB3ToNuke 3.0.4 RC1.
Simple click the following:
http://www.nukekorea.net/modules.php?name=phpBB3&file=viewtopic&f=17&t=10
The whole phpBB3 system was slightly changed.
Oh, by the way, mktime() program is strongly related to 'date' field format in mysql. About this, I will post ONE SUGGESTION to outroot this problem. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
bluerace
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri May 08, 2009 12:28 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
duck
Involved
![Involved Involved](modules/Forums/images/ranks/4stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Jul 03, 2006
Posts: 273
|
Posted:
Fri May 08, 2009 2:03 pm |
|
While your suggestion is on the right mark bluerace of needing to cast vars to int to work I would suggest something like the following might be easier.
Not 100% sure this won't raise some other issue but I don't think so but anyway you could include the following function into mainfile.php and then just do a search replace of mktime( replace with mktime2( in all files.
Code:
function mktime2($var1=0, $var2=0, $var3=0, $var4=0, $var5=0, $var6=0, $var7=-1){
$var1 = (int)$var1;
$var2 = (int)$var2;
$var3 = (int)$var3;
$var4 = (int)$var4;
$var5 = (int)$var5;
$var6 = (int)$var6;
$var7 = (int)$var7;
$returnvar = mktime($var1, $var2, $var3, $var4, $var5, $var6, $var7);
return $returnvar;
}
|
This might be easier than hunting down all the different variables to cast to int. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri May 08, 2009 2:41 pm |
|
$yourvar = mktime((int)$var1,(int)$var2,(int)$var3,(int)$var4,(int)$var5,(int)$var6); |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
bluerace
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri May 08, 2009 3:35 pm |
|
Actually, you don't have to cast when you use different mysql query schemes.
Let me write a post for this. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
duck
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri May 08, 2009 4:02 pm |
|
Guardian2003 wrote: | $yourvar = mktime((int)$var1,(int)$var2,(int)$var3,(int)$var4,(int)$var5,(int)$var6); |
The reason I suggested another function inside mainfile.php is cause if you've recently upgrade then many files throughout your site may be using mktime and failing.
it's ok to change one set of vars to the call when you know where the problem is but when you wanna look through 1000's of files for mktime calls with different variable names that could be a real PITA but a search and replace of mktime( to mktime2( could be done on those same 1000 files in seconds. then all works well. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
eldorado
Involved
![Involved Involved](modules/Forums/images/ranks/4stars.gif)
![](modules/Forums/images/avatars/52f4453749f5c4a233463.gif)
Joined: Sep 10, 2008
Posts: 424
Location: France,Translator
|
Posted:
Fri May 08, 2009 4:10 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri May 08, 2009 11:48 pm |
|
@duck I agree that it would be useful to have such a function, especially for those that are fixing old code and don't have the time to go through thousands of files or who don't use an IDE when developing.
I was actually quite horrified when googling this error to find a lot of sites indexed in google showing this error on site pages and revealing server paths ![Sad](modules/Forums/images/smiles/icon_sad.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
eldorado
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun May 10, 2009 2:32 am |
|
Guardian2003 wrote: | @duck I agree that it would be useful to have such a function, especially for those that are fixing old code and don't have the time to go through thousands of files or who don't use an IDE when developing.
I was actually quite horrified when googling this error to find a lot of sites indexed in google showing this error on site pages and revealing server paths |
oh yeah me too , though I wasn't horrified ![Very Happy](modules/Forums/images/smiles/icon_biggrin.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nextgen
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/Risque/fhf212.jpg)
Joined: Sep 28, 2006
Posts: 241
|
Posted:
Tue May 12, 2009 7:15 pm |
|
Adding the edits to the mainfile has cleared all of my errors. Great solution friends. |
_________________ alterednuke.com Your source for Ravennuke themes. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed May 13, 2009 1:05 am |
|
.. just remember that it's just a band aid. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|