#34765 [NEW]: Parameter checking, especially in date/time functions
From: csg at diatom dot de
Operating system: Linux, probably all
PHP version: 4.4.0
PHP Bug Type: Feature/Change Request
Bug description: Parameter checking, especially in date/time functions
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 bug report at http://bugs.php.net/?id=34765&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34765&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34765&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34765&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34765&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34765&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34765&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34765&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34765&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34765&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34765&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34765&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34765&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34765&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34765&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34765&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34765&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34765&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34765&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34765&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34765&r=mysqlcfg
Thread (2 messages)
- csg at diatom dot de