Jump to content

Warning: date() expects parameter 2 to be long, string given in...


godrob

Recommended Posts

You would only get that error message if the string stored in $_expires is not a long. Since in the OP's code they are setting $_expires = i['expires_date'] and according to the OP the value in the database is '1264164328', the code I posted should work perfectly.

Link to comment
Share on other sites

I would interested in knowing if casting that value as an INT solves the problem, because php has had a significant number of basic and reoccurring bugs (the php change log reads like the clown act in a circus.)

 

The last suggested logic is equivalent to the original logic and it should work without error IF the data is what is being reported. I suspect that this is either something to do with register_globals (they are apparently on) or due to the page being requested more than once and when it is requested a second time $pro_id contains something (or nothing) that returns a result set that contains a value for $i['expires_date'] (which is not empty and is not a Unix Timestamp) that does produce the error message being reported.

 

Edit: and in fact, since the code at the start of the page is setting setcookie("pro_id", "", 0, "/"); there is a high likelihood that the page is being requested a second time with pro_id being an empty string and the inconsistent results being reported are due to a mix of information from two sequential requests for the same page.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.