Skip to content

Instances of object returned by db2_*() functions are always instances of stdClass #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ibm_db2.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function db2_fetch_both($stmt, ?int $row_number = null): array|false {}
/**
* @param resource $stmt
*/
function db2_fetch_object($stmt, ?int $row_number = null): object|false {}
function db2_fetch_object($stmt, ?int $row_number = null): \stdClass|false {}

/**
* @param resource $stmt
Expand All @@ -309,12 +309,12 @@ function db2_setoption($resource, array $options, int $type): bool {}
/**
* @param resource $connection
*/
function db2_client_info($connection): object|false {}
function db2_client_info($connection): \stdClass|false {}

/**
* @param resource $connection
*/
function db2_server_info($connection): object|false {}
function db2_server_info($connection): \stdClass|false {}

function db2_escape_string(string $string_literal): string {}

Expand Down
6 changes: 3 additions & 3 deletions ibm_db2_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3e863612a7a676e042e024f6778b791bd086abe5 */
* Stub hash: e952caf6e14487291104ab1f1fdd7f268cc8a6bc */

ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_connect, 0, 0, 3)
ZEND_ARG_TYPE_INFO(0, database, IS_STRING, 0)
Expand Down Expand Up @@ -205,7 +205,7 @@ ZEND_END_ARG_INFO()

#define arginfo_db2_fetch_both arginfo_db2_fetch_assoc

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_db2_fetch_object, 0, 1, MAY_BE_OBJECT|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_db2_fetch_object, 0, 1, stdClass, MAY_BE_FALSE)
ZEND_ARG_INFO(0, stmt)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, row_number, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
Expand All @@ -220,7 +220,7 @@ ZEND_END_ARG_INFO()

#define arginfo_db2_setoption arginfo_db2_set_option

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_db2_client_info, 0, 1, MAY_BE_OBJECT|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_db2_client_info, 0, 1, stdClass, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_END_ARG_INFO()

Expand Down
2 changes: 1 addition & 1 deletion ibm_db2_legacy_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3e863612a7a676e042e024f6778b791bd086abe5 */
* Stub hash: e952caf6e14487291104ab1f1fdd7f268cc8a6bc */

ZEND_BEGIN_ARG_INFO_EX(arginfo_db2_connect, 0, 0, 3)
ZEND_ARG_INFO(0, database)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_V6_310_ClientInfo.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $conn = db2_connect($database, $user, $password);

$client = db2_client_info( $conn );

if ($client) {
if ($client instanceof \stdClass) {
echo "DRIVER_NAME: "; var_dump( $client->DRIVER_NAME );
echo "DRIVER_VER: "; var_dump( $client->DRIVER_VER );
echo "DATA_SOURCE_NAME: "; var_dump( $client->DATA_SOURCE_NAME );
Expand All @@ -34,4 +34,3 @@ DRIVER_VER: string(%d) %s
DATA_SOURCE_NAME: string(%d) %s
DRIVER_ODBC_VER: string(%d) %s
ODBC_SQL_CONFORMANCE: string(%d) %s