-
-
Notifications
You must be signed in to change notification settings - Fork 17
IBASE_UNIXTIME is system locale dependent #109
Copy link
Copy link
Open
Description
Lines 1392 to 1393 in 23aca98
| if (((type & ~1) != SQL_TYPE_TIME) && (flag & PHP_IBASE_UNIXTIME)) { | |
| ZVAL_LONG(val, mktime(&t)); |
Change system locale and the output changes. It should always be UTC based.
(function() {
$ts = 1762436759; // 2025-11-06 13:45:59 UTC
ibase_query(
"CREATE TABLE TTEST (
TS TIMESTAMP
)"
);
ibase_commit();
ibase_query("INSERT INTO TTEST (TS) VALUES (?)", $ts) or die("ibase_query failed");
dump_table_rows("TTEST");
dump_table_rows("TTEST", null, IBASE_UNIXTIME);
})();TZ='UTC' php script.php
array(1) {
["TS"]=>
string(19) "2025-11-06 13:45:59"
}
array(1) {
["TS"]=>
int(1762436759)
}TZ='Europe/Riga' php script.php
array(1) {
["TS"]=>
string(19) "2025-11-06 13:45:59"
}
array(1) {
["TS"]=>
int(1762429559)
}In database these it is stored as ISC_TIMESTAMP: 60985, 495590000 which is 13:45:59
Fixing this will introduce breaking changes. Maybe put under legacy flag or something.
Reactions are currently unavailable