PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
selectric
Regular
Regular


Joined: Aug 06, 2008
Posts: 65

PostPosted: Mon Apr 13, 2009 1:14 pm Reply with quote Back to top

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!
View user's profile Send private message
bluerace
Regular
Regular


Joined: Apr 04, 2009
Posts: 85
Location: Behind you

PostPosted: Mon Apr 13, 2009 2:21 pm Reply with quote Back to top

read mktime depreciation described in the following url:
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website
selectric
Regular
Regular


Joined: Aug 06, 2008
Posts: 65

PostPosted: Mon Apr 13, 2009 2:30 pm Reply with quote Back to top

bluerace wrote:
read mktime depreciation described in the following url:
Only registered users can see links on this board!
Get registered or login to the forums!


Hey thanks alot for writing up a post about it!
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Fri May 08, 2009 9:47 am Reply with quote Back to top

Says module is not active at that link
View user's profile Send private message Send e-mail Visit poster's website
bluerace
Regular
Regular


Joined: Apr 04, 2009
Posts: 85
Location: Behind you

PostPosted: Fri May 08, 2009 11:32 am Reply with quote Back to top

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:
Only registered users can see links on this board!
Get registered or login to the forums!


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.
View user's profile Send private message Visit poster's website
bluerace
Regular
Regular


Joined: Apr 04, 2009
Posts: 85
Location: Behind you

PostPosted: Fri May 08, 2009 12:28 pm Reply with quote Back to top

Let me write more or less longer description about fundamental solutions to the deprecation and casting of mktime() function as follows:
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website
duck
Involved
Involved


Joined: Jul 03, 2006
Posts: 267

PostPosted: Fri May 08, 2009 2:03 pm Reply with quote Back to top

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.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Fri May 08, 2009 2:41 pm Reply with quote Back to top

$yourvar = mktime((int)$var1,(int)$var2,(int)$var3,(int)$var4,(int)$var5,(int)$var6);
View user's profile Send private message Send e-mail Visit poster's website
bluerace
Regular
Regular


Joined: Apr 04, 2009
Posts: 85
Location: Behind you

PostPosted: Fri May 08, 2009 3:35 pm Reply with quote Back to top

Actually, you don't have to cast when you use different mysql query schemes.
Let me write a post for this.
View user's profile Send private message Visit poster's website
duck
Involved
Involved


Joined: Jul 03, 2006
Posts: 267

PostPosted: Fri May 08, 2009 4:02 pm Reply with quote Back to top

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.
View user's profile Send private message
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 414
Location: France,Translator

PostPosted: Fri May 08, 2009 4:10 pm Reply with quote Back to top

Only registered users can see links on this board!
Get registered or login to the forums!
for references.

I know i've fixed my errors looking on google . But it was last year Sad
View user's profile Send private message Visit poster's website MSN Messenger
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Fri May 08, 2009 11:48 pm Reply with quote Back to top

@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
View user's profile Send private message Send e-mail Visit poster's website
eldorado
Involved
Involved


Joined: Sep 10, 2008
Posts: 414
Location: France,Translator

PostPosted: Sun May 10, 2009 2:32 am Reply with quote Back to top

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 Sad

oh yeah me too , though I wasn't horrified Very Happy
View user's profile Send private message Visit poster's website MSN Messenger
nextgen
Worker
Worker


Joined: Sep 28, 2006
Posts: 135
Location: Maryland

PostPosted: Tue May 12, 2009 7:15 pm Reply with quote Back to top

Adding the edits to the mainfile has cleared all of my errors. Great solution friends.
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Wed May 13, 2009 1:05 am Reply with quote Back to top

.. just remember that it's just a band aid.
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum