Bug #74104 [NEW]: ibase_query and date as a param
| From: | mikedeweese at hotmail dot com | Date: | Wed, 15 Feb 2017 19:33:11 +0000 |
| Subject: | Bug #74104 [NEW]: ibase_query and date as a param | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207393@lists.php.net to get a copy of this message | ||
From: mikedeweese at hotmail dot com
Operating system: CentOS 7
PHP version: 7.0.15
Package: InterBase related
Bug Type: Bug
Bug description:ibase_query and date as a param
Description:
------------
The interbase.so extension parses dates that have two digit years
wrong.
In php.ini, ibase.dateformat = "%m/%d/%Y"
I am able to get correct results by editing function ibase_query.c,
function _php_ibase_bind, forcing "#ifdef HAVE_STRPTIME" to fail, which
causes firebird sql to to parse the string.
This does not fail on my Windows boxes.
Test script:
---------------
CREATE TABLE Z_DEBUG (
FID INTEGER,
FDATE DATE
);
CREATE OR ALTER TRIGGER Z_DEBUG_BI0 FOR Z_DEBUG
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
NEW.FID = NEXT VALUE FOR GEN_MYGEN;
END
<?php
ibase_connect('localhost:TEST', 'sysdba', 'masterkey');
$q = ibase_query("INSERT INTO Z_DEBUG (FDATE) VALUES(?) RETURNING
(FID)", '3/6/17');
$r = ibase_fetch_object($q);
$q2 = ibase_query("SELECT FDATE, extract(year from FDATE) as FYEAR FROM
Z_DEBUG WHERE FID = ?", $r->FID);
$r2 = ibase_fetch_object($q2);
print $r2->FDATE . ' ' . $r2->FYEAR . "\n\n";
Expected result:
----------------
03/06/2017 2017
Actual result:
--------------
03/06/17 17
That is the year 0017, 17 years after 1 BC
--
Edit bug report at https://bugs.php.net/bug.php?id=74104&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74104&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74104&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74104&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74104&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74104&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74104&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74104&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74104&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74104&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74104&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74104&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74104&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74104&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74104&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74104&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74104&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74104&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74104&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74104&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74104&r=mysqlcfg