#41144 [NEW]: Possibly incorrect regex for TIME field type in pg_convert (pg_insert)

From: Date: Fri, 20 Apr 2007 05:36:36 +0000
Subject: #41144 [NEW]: Possibly incorrect regex for TIME field type in pg_convert (pg_insert)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111715@lists.php.net to get a copy of this message
From: shade at nekto dot com Operating system: Windows PHP version: 5.2.1 PHP Bug Type: PostgreSQL related Bug description: Possibly incorrect regex for TIME field type in pg_convert (pg_insert) Description: ------------ I am trying to insert 14:27 value in the datetime field. I think its correct, cause in PostgreSQL manual descripted following time inputs: Table 8.11. Time Input Example | Description 04:05 | ISO 8601 040506 | ISO 8601 .... cutted here.... 04:05:06 PST | time zone specified by name 2003-04-12 04:05:06 America/New_York | time zone specified by full name Only 2003-04-12 04:05:06 matches by time regexp in pg_convert. Here the reported regexp: '^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\.[0-9]+){0,1}([ \t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$' Its realizes logic 'date and maybe time', but it's not only possible input. Also i confised by [ \t]+ , united with XX:XX part of regexp. I think that regexp must be like that: '^(([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2}){0,1}([ \t]+){0,1}(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\.[0-9]+){0,1}([ \t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$' Expected result: ---------------- Inserted value in database table Actual result: -------------- Notice: pg_insert() [function.pg-insert]: '15:04' does not match with '^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\.[0-9]+){0,1}([ \t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\data\index.php on line 226 -- Edit bug report at http://bugs.php.net/?id=41144&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41144&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41144&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41144&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41144&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41144&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41144&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41144&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41144&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41144&r=support Expected behavior: http://bugs.php.net/fix.php?id=41144&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41144&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41144&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41144&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41144&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41144&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41144&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41144&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41144&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41144&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41144&r=mysqlcfg

« previous php.bugs (#111715) next »