#34765 [Opn->Bgs]: Parameter checking, especially in date/time functions
ID: 34765
Updated by: tony2001@php.net
Reported By: csg at diatom dot de
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: Linux, probably all
PHP Version: 4.4.0
New Comment:
There is nothing wrong with those parameters.
Negative or zero params are perfectly valid for mktime().
Previous Comments:
------------------------------------------------------------------------
[2005-10-06 18:35:45] csg at diatom dot de
Description:
------------
Giving some functions -like mktime()- invalid parameters, the result
will be unpredictable - at least from users point of view (see Bug-ID
34760, marked as "Bogus" - sorry for my mistakes there).
Suggestion:
I suggest to emit at least a warning, if functions internal to PHP get
wrong parameters (like an invalid [octal] number)
- instead of silently ignoring the problem and return unexpected
results (as it is currently the case).
Rem.: Of course, numbers with leading zero as in the code example below
will be treated as octal numbers and digit "8" is not allowed there -
but usually date and time values *will* be given in a 2 or 4 digit
format, so using mktime() this way is at least error prone.
So, a warning emited in such a case would be ***very*** fine resp.
would help, to find such errors easier.
Reproduce code:
---------------
<?php mktime(15,0,0,10,08,2005); ?>
Expected result:
----------------
A Timestamp for "Oct-08-2005 15:00", e.g. the number "1 128 776 400"
(without the spaces, of course).
Actual result:
--------------
A Timestamp for "Sep-30-2005 15:00", e.g. number "1 128 085 200".
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34765&edit=1
Thread (2 messages)