php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45004 pg_insert doesn't accept valid timestamps
Submitted: 2008-05-15 11:36 UTC Modified: 2008-05-19 15:18 UTC
From: deusmax at gmail dot com Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 5.2CVS-2008-05-15 (CVS) OS: Linux 2.6.22
Private report: No CVE-ID: None
 [2008-05-15 11:36 UTC] deusmax at gmail dot com
Description:
------------
On inserting into a timestamp with time zone field the function pg_insert() throws the following error:

pg_insert doesn't like timestamps with 

Notice: pg_insert(): '2008-05-15T16:15:16+0000' 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}$'

Pg_insert() works fine for '2008-05015T16:15:16+00',the timezone has only 2 digits.

The 4 digit time zone is:
  1) a valid PhP format, DATE_ISO8601
  2) is accepted fine when doing a regular sql insert 

It seems the regex use by pg_insert for the timestamps with timezone should be updated to accept all formats defined by PhP constants DATE_*




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-19 15:18 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC