Skip to content

Commit d55ef3f

Browse files
committed
ext/pdo_firebird: Added Pdo\Firebird::ATTR_API_VERSION (#14916)
closes #14916
1 parent b2c3f2f commit d55ef3f

8 files changed

+45
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PHP NEWS
88
- OpenSSL:
99
. Bumped minimum required OpenSSL version to 1.1.0. (cmb)
1010

11+
- PDO_FIREBIRD:
12+
. Added Pdo\Firebird::ATTR_API_VERSION. (SakiTakamachi)
13+
1114
- Standard:
1215
. Fix references in request_parse_body() options array. (nielsdos)
1316

UPGRADING

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ PHP 8.4 UPGRADE NOTES
509509
PDO::FB_WRITABLE_TRANSACTION) have been added.
510510
. When using persistent connections, there is now a liveness check in the
511511
constructor.
512+
. The content that is built changes depending on the value of FB_API_VER in
513+
ibase.h, so added the attribute value Pdo\Firebird::ATTR_API_VERSION to
514+
obtain that value. This value can also be referenced from phpinfo.
512515

513516
- PDO_MYSQL:
514517
. getAttribute, enabled to get the value of ATTR_FETCH_TABLE_NAMES.
@@ -805,7 +808,7 @@ PHP 8.4 UPGRADE NOTES
805808
. P_GID (NetBSD/FreeBSD only).
806809
. P_SID (NetBSD/FreeBSD only).
807810
. P_JAILID (FreeBSD only).
808-
811+
809812
- Standard:
810813
. PHP_ROUND_CEILING.
811814
. PHP_ROUND_FLOOR.

ext/pdo_firebird/firebird_driver.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,10 @@ static int pdo_firebird_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
11771177
}
11781178
return 1;
11791179

1180+
case PDO_FB_ATTR_API_VERSION:
1181+
ZVAL_LONG(val, FB_API_VER);
1182+
return 1;
1183+
11801184
case PDO_ATTR_SERVER_VERSION:
11811185
case PDO_ATTR_SERVER_INFO:
11821186
*tmp = 0;

ext/pdo_firebird/pdo_firebird.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ PHP_MSHUTDOWN_FUNCTION(pdo_firebird) /* {{{ */
9393
PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
9494
{
9595
char version[64];
96+
char api_version[8];
9697
isc_get_client_version(version);
9798

99+
snprintf(api_version, 7, "%d", FB_API_VER);
100+
98101
php_info_print_table_start();
99102
php_info_print_table_row(2, "PDO Driver for Firebird", "enabled");
100103
php_info_print_table_row(2, "Client Library Version", version);
104+
php_info_print_table_row(2, "Firebird API version", api_version);
101105
php_info_print_table_end();
102106
}
103107
/* }}} */

ext/pdo_firebird/pdo_firebird.stub.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class Firebird extends PDO
1919
/** @cvalue PDO_FB_ATTR_TIMESTAMP_FORMAT */
2020
public const int ATTR_TIMESTAMP_FORMAT = UNKNOWN;
2121

22+
/** @cvalue PDO_FB_ATTR_API_VERSION */
23+
public const int ATTR_API_VERSION = UNKNOWN;
24+
2225
/** @cvalue PDO_FB_TRANSACTION_ISOLATION_LEVEL */
2326
public const int TRANSACTION_ISOLATION_LEVEL = UNKNOWN;
2427

ext/pdo_firebird/pdo_firebird_arginfo.h

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/pdo_firebird/php_pdo_firebird_int.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ enum {
142142
PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
143143
PDO_FB_ATTR_TIME_FORMAT,
144144
PDO_FB_ATTR_TIMESTAMP_FORMAT,
145+
PDO_FB_ATTR_API_VERSION,
145146

146147
/*
147148
* transaction isolation level
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
PDO_Firebird: get api version
3+
--EXTENSIONS--
4+
pdo_firebird
5+
--SKIPIF--
6+
<?php require('skipif.inc'); ?>
7+
--XLEAK--
8+
A bug in firebird causes a memory leak when calling `isc_attach_database()`.
9+
See https://github.com/FirebirdSQL/firebird/issues/7849
10+
--FILE--
11+
<?php
12+
require("testdb.inc");
13+
$dbh = getDbConnection();
14+
echo $dbh->getAttribute(Pdo\Firebird::ATTR_API_VERSION) . "\n";
15+
echo 'done!';
16+
?>
17+
--EXPECTF--
18+
%d
19+
done!

0 commit comments

Comments
 (0)