Skip to content

Commit

Permalink
Fix UNKNOWN default values in ext/oci8
Browse files Browse the repository at this point in the history
Closes GH-6089
  • Loading branch information
kocsismate committed Sep 8, 2020
1 parent 7e339a3 commit 3b0fecd
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 82 deletions.
2 changes: 1 addition & 1 deletion ext/oci8/oci8.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
Z_PARAM_STRING(username, username_len)
Z_PARAM_STRING(password, password_len)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(dbname, dbname_len)
Z_PARAM_STRING_OR_NULL(dbname, dbname_len)
Z_PARAM_STRING(charset, charset_len)
Z_PARAM_LONG(session_mode)
ZEND_PARSE_PARAMETERS_END();
Expand Down
40 changes: 20 additions & 20 deletions ext/oci8/oci8.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,31 @@ function oci_lob_seek(OCILob $lob_descriptor, int $offset, int $whence = OCI_SEE

function oci_lob_size(OCILob $lob_descriptor): int|false {}

function oci_lob_write(OCILob $lob_descriptor, string $string, int $length = UNKNOWN): int|false {}
function oci_lob_write(OCILob $lob_descriptor, string $string, ?int $length = null): int|false {}

function oci_lob_append(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from): bool {}

function oci_lob_truncate(OCILob $lob_descriptor, int $length = 0): bool {}

function oci_lob_erase(OCILob $lob_descriptor, int $offset = UNKNOWN, int $length = UNKNOWN): int|false {}
function oci_lob_erase(OCILob $lob_descriptor, ?int $offset = null, ?int $length = null): int|false {}

function oci_lob_flush(OCILob $lob_descriptor, int $flag = 0): bool {}

function ocisetbufferinglob(OCILob $lob_descriptor, bool $mode): bool {}

function ocigetbufferinglob(OCILob $lob_descriptor): bool {}

function oci_lob_copy(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from, int $length = UNKNOWN): bool {}
function oci_lob_copy(OCILob $lob_descriptor_to, OCILob $lob_descriptor_from, ?int $length = null): bool {}

function oci_lob_is_equal(OCILob $lob_descriptor_first, OCILob $lob_descriptor_second): bool {}

function oci_lob_export(OCILob $lob_descriptor, string $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {}
function oci_lob_export(OCILob $lob_descriptor, string $path, ?int $start = null, ?int $length = null): bool {}

/**
* @alias oci_lob_export
* @deprecated
*/
function ociwritelobtofile(OCILob $lob_descriptor, string $path, int $start = UNKNOWN, int $length = UNKNOWN): bool {}
function ociwritelobtofile(OCILob $lob_descriptor, string $path, ?int $start = null, ?int $length = null): bool {}

/**
* @param resource $connection_resource
Expand Down Expand Up @@ -332,50 +332,50 @@ function ocilogoff($connection_resource): bool|null {}
/**
* @return resource|false
*/
function oci_new_connect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
function oci_new_connect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}

/**
* @return resource|false
* @alias oci_new_connect
* @deprecated
*/
function ocinlogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
function ocinlogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}

/**
* @return resource|false
*/
function oci_connect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
function oci_connect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}

/**
* @return resource|false
* @alias oci_connect
* @deprecated
*/
function ocilogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
function ocilogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}

/**
* @return resource|false
*/
function oci_pconnect(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
function oci_pconnect(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}

/**
* @return resource|false
* @alias oci_pconnect
* @deprecated
*/
function ociplogon(string $username, string $password, string $connection_string = UNKNOWN, string $character_set = '', int $session_mode = OCI_DEFAULT) {}
function ociplogon(string $username, string $password, ?string $connection_string = null, string $character_set = '', int $session_mode = OCI_DEFAULT) {}

/**
* @param resource $connection_or_statement_resource
* @param resource|null $connection_or_statement_resource
*/
function oci_error($connection_or_statement_resource = UNKNOWN): array|false {}
function oci_error($connection_or_statement_resource = null): array|false {}

/**
* @param resource|null $connection_or_statement_resource
* @alias oci_error
* @deprecated
*/
function ocierror($connection_or_statement_resource = UNKNOWN): array|false {}
function ocierror($connection_or_statement_resource = null): array|false {}

/**
* @param resource $statement_resource
Expand Down Expand Up @@ -592,14 +592,14 @@ function ocicolltrim(OCICollection $collection, int $number): bool {}
/**
* @param resource $connection_resource
*/
function oci_new_collection($connection_resource, string $type_name, string $schema_name = UNKNOWN): OCICollection|false {}
function oci_new_collection($connection_resource, string $type_name, ?string $schema_name = null): OCICollection|false {}

/**
* @param resource $connection_resource
* @alias oci_new_collection
* @deprecated
*/
function ocinewcollection($connection_resource, string $type_name, string $schema_name = UNKNOWN): OCICollection|false {}
function ocinewcollection($connection_resource, string $type_name, ?string $schema_name = null): OCICollection|false {}

/**
* @param resource $connection_resource
Expand Down Expand Up @@ -676,7 +676,7 @@ public function size() {}
* @alias oci_lob_write
* @return int|false
*/
public function write(string $string, int $length = UNKNOWN) {}
public function write(string $string, ?int $length = null) {}

/**
* @alias oci_lob_append
Expand All @@ -694,7 +694,7 @@ public function truncate(int $length = 0) {}
* @alias oci_lob_erase
* @return int|false
*/
public function erase(int $offset = UNKNOWN, int $length = UNKNOWN) {}
public function erase(?int $offset = null, ?int $length = null) {}

/**
* @alias oci_lob_flush
Expand All @@ -718,13 +718,13 @@ public function getbuffering() {}
* @alias oci_lob_export
* @return bool
*/
public function writetofile(string $path, int $start = UNKNOWN, int $length = UNKNOWN) {}
public function writetofile(string $path, ?int $start = null, ?int $length = null) {}

/**
* @alias oci_lob_export
* @return bool
*/
public function export(string $path, int $start = UNKNOWN, int $length = UNKNOWN) {}
public function export(string $path, ?int $start = null, ?int $length = null) {}

/**
* @alias oci_lob_write_temporary
Expand Down
30 changes: 15 additions & 15 deletions ext/oci8/oci8_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: 447880a4bc4add36beab835cc07c09a254dc0c2b */
* Stub hash: 2d553815c21edd58bc29b1ca8d294d5750fd7312 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement_resource)
Expand Down Expand Up @@ -80,7 +80,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_append, 0, 2, _IS_BOOL, 0)
Expand All @@ -95,8 +95,8 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_lob_erase, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_flush, 0, 1, _IS_BOOL, 0)
Expand All @@ -114,7 +114,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_copy, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob_descriptor_to, OCILob, 0)
ZEND_ARG_OBJ_INFO(0, lob_descriptor_from, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_is_equal, 0, 2, _IS_BOOL, 0)
Expand All @@ -125,8 +125,8 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_lob_export, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, lob_descriptor, OCILob, 0)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

#define arginfo_ociwritelobtofile arginfo_oci_lob_export
Expand Down Expand Up @@ -254,7 +254,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_oci_new_connect, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_string, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, character_set, IS_STRING, 0, "\'\'")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, session_mode, IS_LONG, 0, "OCI_DEFAULT")
ZEND_END_ARG_INFO()
Expand All @@ -270,7 +270,7 @@ ZEND_END_ARG_INFO()
#define arginfo_ociplogon arginfo_oci_new_connect

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_oci_error, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection_or_statement_resource)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection_or_statement_resource, "null")
ZEND_END_ARG_INFO()

#define arginfo_ocierror arginfo_oci_error
Expand Down Expand Up @@ -426,7 +426,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_new_collection, 0, 2, OCICollection, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection_resource)
ZEND_ARG_TYPE_INFO(0, type_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, schema_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema_name, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

#define arginfo_ocinewcollection arginfo_oci_new_collection
Expand Down Expand Up @@ -471,7 +471,7 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_write, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_append, 0, 0, 1)
Expand All @@ -483,8 +483,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_truncate, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_erase, 0, 0, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_OCILob_flush, 0, 0, _IS_BOOL, 0)
Expand All @@ -499,8 +499,8 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_OCILob_writetofile, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

#define arginfo_class_OCILob_export arginfo_class_OCILob_writetofile
Expand Down

0 comments on commit 3b0fecd

Please sign in to comment.