Topic: Common php Warnings and Errors
If your error isn't in this list don't bother looking through this topic.
* date() expects parameter 2 to be long, ...
* Warning: Division by zero (...)
* Smilies display vertical
* Error 500: Internal Server Error
* failed to open stream: Permission denied in (...)
* Warning: preg_replace(): Compilation failed: unmatched parentheses
* Failed to open stream: No such file or directory
* Fatal error: Allowed memory size of (...) bytes exhausted (tried to allocate (...) bytes)
* Warning: main() [function.main]: URL file-access is disabled ...
* Deprecated: Function eregi() is deprecated in ...
* Deprecated: Function split() is deprecated in ...
* Fatal error: Maximum execution time of ## seconds exceeded
* Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
As we have many variations regarding this let's write a nice tutorial.
Warning: date() expects parameter 2 to be long, string given in /home/****/public_html/***/cutenews/inc/main.mdu on line 140
now note that this error says main.mdu on line 140. Yours may say something different at the end. No worry, keep reading.
Now we open the file given by the warning: main.mdu
How? With your favorite editor. I suggest using Notepad if you're a windows user.
Now that we have opened the file we'll go to line 140.
How?Notepad and some other editors can easily find a certain line with ctrl + g, now all you got to do is type in the desired line.
$last_login_year = date("Y", $member_db);
The line will always have
1) Now find the , and add (int) after it.
Now we know where the problem is caused. So we can fix it.
this doesn't work for everyone but it is the best fix.
put this before the variable that causes problems.
in this case we would get
$last_login_year = date("Y", (int)$member_db);
2) if that didn't work, make a empty line above line given by your warning. (DON'T delete the code above this line if there is code there)
Now put this on that empty line and keep in mind that you need to replace the variable in this example with the variable that gives you trouble.
if( !is_numeric( $member_db ) ) $member_db = time();
3) save changes and upload your edited file in the inc folder.
Credits go to Eyece and Damoor.