#42640 [Fbk->Opn]: error in date_parse function
ID: 42640 User updated by: david at zschille dot net Reported By: david at zschille dot net -Status: Feedback +Status: Open Bug Type: Date/time related Operating System: Win XP PHP Version: 5CVS-2007-09-12 (snap) New Comment: The PHP manual says about the return values: "Returns array on success or FALSE on failure". You can see here that it returns not FALSE but an array. Is the error in the manual or in the behavior of the function? To the string "19044-05-09": it get parsed as 19:04:00 2004-05-09. This is not correct. Previous Comments: [2007-09-12 11:09:59] [EMAIL PROTECTED] Can you please clarify what is the problem? As you can see, there are errors in the output for "abc123"..and yes, "19044-05-09" is valid date. Just very far in the future. -------- [2007-09-12 08:50:08] david at zschille dot net Description: In the php manual is written that the parameter for date_parse should be a "Date in format accepted by strtotime()" and it "returns array on success or FALSE on failure". So if i give a not valid format to the function i expect a FALSE. Also interesting is the behavior of date_parse when i give the string "19044-05-09" to it. It produces no error and no warning message and seems to be valid!? But the string is also valid for strtotime(). Has this function also an error or is this string really valid? Reproduce code: --- var_dump( date_parse( 'abc123' ) ); Expected result: bool false Actual result: -- array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> bool(false) ["minute"]=> bool(false) ["second"]=> bool(false) ["fraction"]=> bool(false) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(4) ["errors"]=> array(4) { [0]=> string(47) "The timezone could not be found in the database" [3]=> string(20) "Unexpected character" [4]=> string(20) "Unexpected character" [5]=> string(20) "Unexpected character" } ["is_localtime"]=> bool(true) ["zone_type"]=> int(0) } -- Edit this bug report at http://bugs.php.net/?id=42640&edit=1
#42640 [NEW]: error in date_parse function
From: david at zschille dot net Operating system: Win XP PHP version: 5CVS-2007-09-12 (snap) PHP Bug Type: Date/time related Bug description: error in date_parse function Description: In the php manual is written that the parameter for date_parse should be a "Date in format accepted by strtotime()" and it "returns array on success or FALSE on failure". So if i give a not valid format to the function i expect a FALSE. Also interesting is the behavior of date_parse when i give the string "19044-05-09" to it. It produces no error and no warning message and seems to be valid!? But the string is also valid for strtotime(). Has this function also an error or is this string really valid? Reproduce code: --- var_dump( date_parse( 'abc123' ) ); Expected result: bool false Actual result: -- array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> bool(false) ["minute"]=> bool(false) ["second"]=> bool(false) ["fraction"]=> bool(false) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(4) ["errors"]=> array(4) { [0]=> string(47) "The timezone could not be found in the database" [3]=> string(20) "Unexpected character" [4]=> string(20) "Unexpected character" [5]=> string(20) "Unexpected character" } ["is_localtime"]=> bool(true) ["zone_type"]=> int(0) } -- Edit bug report at http://bugs.php.net/?id=42640&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42640&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42640&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42640&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42640&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42640&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42640&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42640&r=needscript Try newer version:http://bugs.php.net/fix.php?id=42640&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42640&r=support Expected behavior:http://bugs.php.net/fix.php?id=42640&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42640&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42640&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42640&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42640&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42640&r=dst IIS Stability:http://bugs.php.net/fix.php?id=42640&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42640&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42640&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42640&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42640&r=mysqlcfg