#41144 [Opn->Fbk]: Possibly incorrect regex for TIME field type in pg_convert (pg_insert)

From: Date: Tue, 28 Oct 2008 22:28:44 +0000
Subject: #41144 [Opn->Fbk]: Possibly incorrect regex for TIME field type in pg_convert (pg_insert)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130254@lists.php.net to get a copy of this message
ID: 41144 Updated by: jani@php.net Reported By: shade at nekto dot com -Status: Open +Status: Feedback Bug Type: PostgreSQL related Operating System: Windows PHP Version: 5.2.1 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2008-10-28 22:28:19] jani@php.net yohgaki seems to have left us so de-assigning. ------------------------------------------------------------------------ [2007-04-20 05:46:56] shade at nekto dot com Err.. >I am trying to insert 14:27 value in the datetime field. Really - in TIME field. Here is SQL: "time_from time with time zone" ------------------------------------------------------------------------ [2007-04-20 05:36:36] shade at nekto dot com 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 this bug report at http://bugs.php.net/?id=41144&edit=1

« previous php.bugs (#130254) next »